邮件中的 Web 链接未在 yahoo 中呈现为链接
string from = "[电子邮件受保护]"; string to = "[电子邮件受保护],[电子邮件受保护]"; 字符串密码=“abcxyz”;
MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "Check Email", System.Text.Encoding.UTF8);
mail.Subject = "This is a test mail";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "<html><body><h1>My Message</h1><br><a href=www.stackoverflow.com>stackoverflow</a></body></html>";
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(from,password);
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Send(mail);
此代码已成功发送邮件。当我查看我的 gmail 时,“stackoverflow”链接呈现为链接,我能够导航到相应的页面,但在 yahoo 中我找不到任何链接,而只出现文本“stackoverflow”。
string from = "[email protected]";
string to = "[email protected],[email protected]";
string password="abcxyz";
MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "Check Email", System.Text.Encoding.UTF8);
mail.Subject = "This is a test mail";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "<html><body><h1>My Message</h1><br><a href=www.stackoverflow.com>stackoverflow</a></body></html>";
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(from,password);
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Send(mail);
This code successfully sents the mail. When i look at my gmail, the "stackoverflow" link renders as link and i was able to navigate to the respective page, but in yahoo i don't find any link instead just the text "stackoverflow" appears.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
stackoverflow
您忘记了
http://
<a href="http://www.stackoverflow.com">stackoverflow</a>
You forgot the
http://
也许雅虎! Mail 对于不带引号的 HTML 属性值不太宽容,请尝试以下操作:
Perhaps Yahoo! Mail is less forgiving about unquoted HTML attribute values, try this instead:
尝试
Try
尝试指定一个有效的 html:
Try specifying a valid html:
当发送大量 html 内容作为正文时,http 确实很重要。这是我的配置文件中的代码让我感到困扰。当我添加http时,它工作正常,没有http,雅虎失败。
When sending bulk of html content as body, http do matter. This is the code in my config file troubled me. When i added http, it works fine, without http, yahoo fails.