SmtpClient を使用して添付ファイル付きの簡単なメールを送信していますが、次のエラーが発生します。
メールボックスを利用できません。サーバーの応答は次のとおりでした: ローカル ホスト example.com ではなく、ゲートウェイではありません
System.Net.Mail.SmtpFailedRecipientException: メールボックスを利用できません。
サーバーの応答は次のとおりでした: ローカル ホスト example.com ではなく、System.Net.Mail.SmtpTransport.SendMail(MailAddress 送信者、MailAddressCollection 受信者、文字列 deliveryNotify、SmtpFailedRecipientException& 例外) のゲートウェイではありません System.Net.Mail.SmtpClient.Send(MailMessageメッセージ)
そしてコード:
public static void CreateMessageWithAttachment(byte[] compressed)
{
// Create a message and set up the recipients.
MailMessage message = new MailMessage(
"noreply@example.com",
"recepient@example.com",
"Hello.",
"How are you?");
// Create the file attachment for this e-mail message.
Stream attachStream = new MemoryStream(compressed);
Attachment attachment = new Attachment(attachStream, MediaTypeNames.Application.Octet);
message.Attachments.Add(attachment);
//Send the message.
SmtpClient client = new SmtpClient("123.12.12.123");
// Add credentials if the SMTP server requires them.
client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Send(message);
attachment.Dispose();
}
もちろん、ドメインと IP は元のコードで有効です。「localhost」とIPの両方を使用してみましたが、同じエラーが発生しました。グーグルは3つの結果を返しましたが、そのうち役立つのは中国語であり、ファイアウォールが翻訳を妨げているようです。
前もって感謝します。