gpt4 book ai didi

asp.net - 如何从我的网络应用程序发送电子邮件?

转载 作者:行者123 更新时间:2023-12-02 08:58:57 25 4
gpt4 key购买 nike

Possible Duplicates:
ASP.NET- Sending an e-mail
how to send mail using C#?

如何从 ASP.NET Web 应用程序发送电子邮件?

最佳答案

这是一个例子

MailMessage mailMessage = new MailMessage(new MailAddress("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7300161d17160133161e121a1f5d101c1e" rel="noreferrer noopener nofollow">[email protected]</a>", "Sender Name"), new MailAddress("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1c4ccc0c8cde1c4ccc0c8cd8fc2cecc" rel="noreferrer noopener nofollow">[email protected]</a>"));
mailMessage.Subject = "Some subject";
mailMessage.Body = msg;
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Send(mailMessage);

web.config 中的设置配置

 <system.net>
<mailSettings>
<smtp>
<network
host="mail.email.com"
port="587"
userName="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cabfb9afb88aafa7aba3a6e4a9a5a7" rel="noreferrer noopener nofollow">[email protected]</a>"
password="xxxx" />
</smtp>
</mailSettings>

关于asp.net - 如何从我的网络应用程序发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2691350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com