1

SMTP(c#)を使用して、グループID(公式ID)にメールを送信しようとしていますが、メールを送信できません。同じコードを使用して、個々のIDにメールを送信できます。ここで何が間違っている可能性があるかについての考え。私が使用している次のコード

MailMessage mail = new MailMessage();
mail.To = "group@company.com";
mail.From = "me@company.com";
mail.Subject = "Test Mail: please Ignore";
mail.Body = body;
SmtpMail.SmtpServer = "mailhub.int.company.com";
SmtpMail.Send(mail)

メールボックスに次のエラーが表示されます。

Delivery has failed to these recipients or distribution lists:

group@company.com
Not Authorized. You are not authorized to send to this recipient or distribution list. For distribution lists please check approved senders in the corporate directory.

  _____  

Sent by Microsoft Exchange Server 2007    

Diagnostic information for administrators:

Generating server: GSPWMS005.int.company.com

group@company.com
#550 5.7.1 RESOLVER.RST.AuthRequired; authentication required ##

エラーから、一部の認証が欠落していることがわかりましたが、どの認証またはそれを解決するかがわかりません。私がこのグループに私の見通しを通してメールを送るならば、それはうまくいきます。

4

1 に答える 1

1

http://msdn.microsoft.com/en-us/library/59x2s2s6.aspx

MailMessage message = new MailMessage(from, to);

message.Body = "This is a test e-mail message sent by an application. ";
message.Subject = "Test Email using Credentials";

NetworkCredential myCreds = new NetworkCredential("username", "password", "domain");
CredentialCache myCredentialCache = new CredentialCache();        
try 
{
    myCredentialCache.Add("ContoscoMail", 35, "Basic", myCreds);
    myCredentialCache.Add("ContoscoMail", 45, "NTLM", myCreds);

    client.Credentials = myCredentialCache.GetCredential("ContosoMail", 45, "NTLM");
    client.Send(message);
    Console.WriteLine("Goodbye.");
}
catch(Exception e)
{
    Console.WriteLine("Exception is raised. ");
    Console.WriteLine("Message: {0} ",e.Message);
}
于 2012-08-29T09:31:54.490 に答える