0

私は例外を取得しています

メールボックス名は許可されていません。サーバーの応答は次のとおりです。

メール送信コードはこちら

public void SendEmail()
    {
        try
        {
            string Smtp_Client = System.Configuration.ConfigurationManager.AppSettings["Smtp_Client"];
            string NewtwrkCredentials_Uname = System.Configuration.ConfigurationManager.AppSettings["NewtwrkCredentials_Uname"];
            string NewtwrkCredentials_P = System.Configuration.ConfigurationManager.AppSettings["NewtwrkCredentials_P"];

            //Declaration a list of attendees
            MailAddressCollection macCollection = new MailAddressCollection();
            //Add attendde. In this example, I send invite to only one
            macCollection.Add(new MailAddress("****@****.com"));
            //Create mail message
            MailMessage mmMessage = formMailMessage("Test", "Test", "***.***@gmail.com", macCollection);
            //Create smtp client
            SmtpClient smtp = new SmtpClient("smtpout.europe.secureserver.net", 25);
            //Configure your smtp client
            smtp.EnableSsl = false;
            smtp.Credentials = new NetworkCredential("****@*****.com", "****");
            //Send it
            smtp.Send(mmMessage);

        }
        catch (Exception er)
        {

        }

    }

    public static MailMessage formMailMessage(string strSubject, string strBodyHTML, string Email, MailAddressCollection macAttendeeList)
    {
        //Create an instance of mail message
        MailMessage mmMessage = new MailMessage();
        //  Set up the different mime types contained in the message
        System.Net.Mime.ContentType typeText = new System.Net.Mime.ContentType("text/plain");
        System.Net.Mime.ContentType typeHTML = new System.Net.Mime.ContentType("text/html");

        AlternateView viewHTML = AlternateView.CreateAlternateViewFromString(strBodyHTML, typeHTML);
        mmMessage.AlternateViews.Add(viewHTML);
        //Adress the message
        mmMessage.From = new MailAddress(Email);
        foreach (MailAddress attendee in macAttendeeList)
        {
            mmMessage.To.Add(attendee);
        }
        mmMessage.Subject = strSubject;
        return mmMessage;
    }

私が間違っていることについて、誰かがコードを手伝ってくれますか? コンソール アプリケーションを作成し、同じコードを使用したところ、問題なく動作しました。SMTP サーバー、ネットワーク資格情報はすべて適切です。

親切に助けて

4

2 に答える 2

0

別のSMTPサーバーを使用し、コードが機能した問題が何であるかはわかりません。

于 2013-01-11T08:54:03.733 に答える
0

発信者アドレスが電子メール アドレスのブラック リストに含まれているというエラーがほとんどです。

サーバーを管理するシステム管理者がいる場合は、その管理者に連絡して問題を解決するか、別のアドレスを使用して送信してください。

ホストされたサービスの場合は、プロバイダーに連絡して通知し、使用する資格情報を尋ねてください。

于 2012-11-26T09:58:31.183 に答える