「txtMail」(受信者) から特定のアドレスにデバッグ モードで送信ボタンを押すと、この「ポップアップ」エラーが発生します。
MailerException はユーザー コードによって処理され
ませんでした メールボックスを利用できません。
サーバーの応答は次のとおりです: 4.7.1 クライアント ホストが拒否されました: ホスト名が見つかりません [IP]
コードは実際には次の最後の行でトリップします。
catch(Exception ex)
{
throw new MailerException(ex.Message, ex);
}
コード自体に問題があるとは思いませんが、コード全体を以下に示しますので、誰かが問題を発見できるかもしれません:
public void SendMail()
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
// Mail from
if (!string.IsNullOrEmpty(this.mailFrom))
message.From = new MailAddress(this.mailFrom);
else
message.From = from;
if (!IsValidEmailAddress(message.From.Address))
throw new MailAddressException("From address " + message.From + " is not valid");
//message.From = from;
// Add recipients
if (_RecipientNames.Count == 0)
throw new RecipientException("No recipients added");
StringBuilder Recipients = new StringBuilder();
for(int i = 0; i < _RecipientEmailAddresses.Count; i++)
{
if (_RecipientNames[i].ToString().Length > 0)
message.To.Add(new MailAddress((string)_RecipientEmailAddresses[i], (string)_RecipientNames[i]));
else
message.To.Add(new MailAddress((string)_RecipientEmailAddresses[i]));
}
foreach (MailAddress ma in this._Bcc)
message.Bcc.Add(ma);
if (this._ReplyToAddress != null)
message.ReplyTo = this._ReplyToAddress;
message.Subject = _Subject;
message.IsBodyHtml = this.isHtmlMail;
message.BodyEncoding = this.BodyEncoding;
// Priority
message.Priority = this.priorityLevel;
// Load template file?
if (_TemplateFile.Length > 0)
{
message.Body = GetMailTemplateContents();
}
else
message.Body = _MailBody;
// Attachments given?
if (this.attachments.Count > 0)
{
foreach (Attachment a in this.attachments)
message.Attachments.Add(a);
}
SmtpClient client = new SmtpClient(_SmtpServer);
try
{
client.Send(message);
}
catch(System.Web.HttpException ex)
{
throw new MailerException(ex.Message,ex);
}
catch(System.Runtime.InteropServices.COMException ex)
{
// Rethrow the exception
throw new MailerException(ex.Message, ex);
}
catch(Exception ex)
{
throw new MailerException(ex.Message, ex);
}
これは実際には、配信しようとしているサーバーから返されたエラー コードだと言う人もいるかもしれません。(メールボックスがいっぱい、無効なメールアドレスなど)
いずれにせよ、メールサーバーの管理者が解決する必要がありますか? このエラーが発生する理由を知っている人はいますか?
必要に応じて、その他の情報を喜んで提供します。
前もって感謝します、