小编Ali*_*han的帖子

在c#中编译邮件的HTML正文

我使用以下代码向用户发送报价给我的电子邮件.

    using System.Net.Mail;

    MailMessage mail = new MailMessage();
    mail.From = new MailAddress(Email.Text);
    mail.To.Add("my yahoo email");
    mail.Subject = "Requested Quote From my site";
    mail.Body = "<br /><b>Primary project type:</b> " + ProjectTypeRadio.SelectedItem.Text + "<br /><b>Interested In:</b> " + InterestedCheck + "<br /><br /><br /><br /><b>PRODUCT DETAILS:</b><hr />" + Electric + HotWater + PoolHeating + SpaceHeating + "<br /> + "<br /><b>Message:</b><br /><hr /><br />" + txtMsg.Text + "<br /><br />";

    SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com");
    smtp.Send(mail);
    Response.Redirect("Thanks.aspx");
Run Code Online (Sandbox Code Playgroud)

Web.Config中

<system.net>
<mailSettings>
  <smtp> …
Run Code Online (Sandbox Code Playgroud)

c# asp.net email smtp

3
推荐指数
1
解决办法
3675
查看次数

标签 统计

asp.net ×1

c# ×1

email ×1

smtp ×1