来自 = "abc@gmail.com" 的字符串;字符串 = “xyz@gmail.com,xyz@yahoo.co.in”;字符串密码="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”文本。