0
別のページにリダイレクトする前にメールが正しく送信されているかどうかを確認する方法が不思議です。それは速くないなら、要求が..ファンクションメールを送信する
while (reader.Read())
{
Fct.SendEmail("test.test.com", "test.test.com", "Maxime", userEmail, "[email protected]", "Access to our portal/Your password", body);
}
Response.Redirect("Logon.aspx");
を終了していると、これは私の関数である前にリダイレクトされますのでして電子メールを送信:
public void SendEmail(string smtpServer, string mailFrom, string mailFromDisplayName, string mailTo, string mailCc, string subject, string body)
{
try
{
using (SmtpClient client = new SmtpClient(smtpServer))
{
string to = mailTo != null ? string.Join(",", mailTo) : null;
string cc = mailCc != null ? string.Join(",", mailCc) : null;
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.From = new MailAddress(mailFrom, mailFromDisplayName);
mail.To.Add(to);
if (cc != null)
{
mail.Bcc.Add(cc);
}
mail.Subject = subject;
mail.Body = body.Replace(Environment.NewLine, "<BR>");
mail.IsBodyHtml = true;
client.Send(mail);
}
}
catch (Exception ex)
{ ex.ToString(); }
}
この「Fct」クラス/オブジェクトとは何ですか? –
あなたの質問は非常に不明であり、あなたのコードは本当に私たちが見る必要がある重要なコードではないようです。 –
私は最初の投稿を編集しました! – Kiwimoisi