如何使用处理程序发送邮件?
我想发送邮件,所以我在 handler.ashx 中编写了一种方法,但出现错误,因为
“SendUsing”配置值无效。 是什么意思
请帮助我public bool Sendmail() { 布尔 strResult = false; 尝试 {
email.Subject = " Registration";
email.To = "[email protected]";
email.From = "[email protected]";
email.Cc = "[email protected]";
email.Bcc = "[email protected]";
email.BodyFormat = MailFormat.Html;
email.Body = "<html>" +
"<body>" +
"<b>Hi ravi</b>"+
"</body>" +
"</html>";
email.Priority = MailPriority.Normal;
SmtpMail.Send(email);
strResult = true;
}
catch (Exception ex)
{
//FTEHelper.SendEmail("[email protected]", "Ticket Upload Batch Error",
// ex.ToString());
strResult = false;
}
return strResult;
}
i want to send mail so i wrote one method in handler.ashx but i got error as
The "SendUsing" configuration value is invalid. what does it mean pls help me
public bool Sendmail()
{
bool strResult = false;
try
{
email.Subject = " Registration";
email.To = "[email protected]";
email.From = "[email protected]";
email.Cc = "[email protected]";
email.Bcc = "[email protected]";
email.BodyFormat = MailFormat.Html;
email.Body = "<html>" +
"<body>" +
"<b>Hi ravi</b>"+
"</body>" +
"</html>";
email.Priority = MailPriority.Normal;
SmtpMail.Send(email);
strResult = true;
}
catch (Exception ex)
{
//FTEHelper.SendEmail("[email protected]", "Ticket Upload Batch Error",
// ex.ToString());
strResult = false;
}
return strResult;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该指定一个 SMTP 服务器。
此外,您还应该考虑使用 System.Net.Mail 命名空间而不是 System.Web.Mail。 (当然,如果您没有被迫使用 .NET 1。)
You should specify an SMTP server.
Also you should consider using System.Net.Mail namespace instead of System.Web.Mail. (If you aren't forced to use .NET 1, of course.)