我从我的网站发送电子邮件,我希望在邮箱中有特别标题,如下图所示。当我发送电子邮件时,它会将其地址显示为标题。如何在asp.net的电子邮件中显示特殊条款作为标题。例如,我想表明这一点:
Avestia Publishing而不是no-reply@avestia.com
我使用此代码发送电子邮件:
bodyMsg.Append("<p>Dear admin,</p>" + RadioButtonList_Prefix.SelectedItem.Text + " " + name.Text + " " + lastname.Text + " has registered in submissin system as an author.<p></br></br></br>Best regards,</p><p>Avestia Publishing</p>");
msg.IsBodyHtml = true;
msg.Body = bodyMsg.ToString();
msg.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
msg.Priority = MailPriority.High;
// msg.ReplyTo = new MailAddress(TextBox2.Text);
msg.From = new MailAddress("no-reply@avestia.com");
msg.To.Add(new MailAddress(*****));
SmtpClient mailsender = new SmtpClient();
mailsender.Host = "SmtpClient.gerbera.arvixe.com";
mailsender.Port = 587;
mailsender.EnableSsl = true;
mailsender.Credentials = new System.Net.NetworkCredential("no-reply@avestia.com", "classaspnet");
SmtpClient smtp = new SmtpClient();
//Literal1.Text = "<script>alert(' ')</script>";
smtp.Send(msg);
任何人都可以帮助我吗?
答案 0 :(得分:1)
改变这个:
msg.From = new MailAddress("no-reply@avestia.com");
对此:
msg.From = new MailAddress("no-reply@avestia.com", "Avestia Publishing");