gpt4 book ai didi

c# - 来自网站的电子邮件未生成 html?

转载 作者:行者123 更新时间:2023-11-30 20:31:54 24 4
gpt4 key购买 nike

我正在使用此代码从我的网站发送电子邮件(取自此处 https://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/aspnet-c39624/send-an-e-mail-using-aspnet-a604246.html)

//create the mail message
MailMessage mail = new MailMessage();
//set the FROM address
mail.From = new MailAddress(from);
//set the RECIPIENTS
mail.To.Add(to);
//enter a SUBJECT
mail.Subject = subject;
//Enter the message BODY
mail.Body = body;
//set the mail server (default should be smtp.1and1.com)
SmtpClient smtp = new SmtpClient("smtp.1and1.com");
//Enter your full e-mail address and password
smtp.Credentials = new NetworkCredential("admin@blank.com", "Password");
//send the message
smtp.Send(mail);

发送的电子邮件未生成 html。因此,它不会显示链接,而是包含链接等的实际代码。

我做错了什么?

最佳答案

您必须添加以下行:

mail.IsBodyHtml = true;

关于c# - 来自网站的电子邮件未生成 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42376874/

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