이것은 내가하는 일입니다. 완벽하지는 않지만 도움이됩니다.
protected void CreateUserWizard1_SendMailError(object sender, SendMailErrorEventArgs e)
{
// e.Exception can be one of the exceptions generated from SmtpClient.Send(MailMessage)
if (e.Exception is SmtpFailedRecipientException)
{
// The message could not be delivered to one or more of the recipients in To, CC, or BCC()()().
// TODO: Set an error message on the page
e.Handled = true;
// Since the user has already been created at this point, we need to remove them.
Membership.DeleteUser(CreateUserWizard1.UserName);
// Set an internal flag for use in the ActiveStepChanged event.
emailFailed = true;
return;
}
}
protected void CreateUserWizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (CreateUserWizard1.ActiveStep != CreateUserWizard1.CompleteStep)
return;
if (emailFailed)
{
// If the email failed, keep the user on the first step.
CreateUserWizard1.ActiveStepIndex = 0;
return;
}
}
실제로 충분하지만 이메일을 보낼 수 없다는 것을 사용자에게 알리는 방법은 무엇입니까? –
GMAIL과 같은 일부 API를 살펴 보거나 Exchange에이 기능이 있는지 확인하십시오. 이메일에 오류가 발생하여 전송 실패가 다시 전송되어 이벤트를 처리하지 않아야합니다. 그 메시지를 알아내는 메시지. 일/주 후에 문제가 될 수 있습니다. –