如何使用带有嵌入式HTML TABLE的C#发送电子邮件 [英] How to send the email using C# with embeded HTML TABLE

查看:107
本文介绍了如何使用带有嵌入式HTML TABLE的C#发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的C#应用​​程序中,我想将电子邮件发送给嵌入HTML表的客户.如何做到这一点.谁能帮我解决这个问题.这是我需要的模型:

尊敬的客户,

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/>/>


XXXXXXXXXX XXXXXXXXXX
xxxxx xxxxxx
xxxxx xxxxxx //喜欢此表
xxxxx xxxxxxx
xxxxxx xxxxxxxxx

谢谢

xxxxxx



在Advance中致谢

Hi,

In my C# application I want to send the email to customers with embeded HTML Table. How to do this one. Can any one help me to solve this problem. Here is the model I need:

Dear Customer,

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



XXXXXXXXXX XXXXXXXXXX
xxxxx xxxxxx
xxxxx xxxxxx //Like this table
xxxxx xxxxxxx
xxxxxx xxxxxxxxx

Thanks

xxxxxx



Thanks in Advance

推荐答案

您可以使用HTML标签创建正文
You can create body using HTML tags
string body = "You have received a status update from " + Session["name"].ToString() + ", Department : " + Session["deptt"].ToString() + "  ,with reference to Assignment ID: " + lblassno.Text + " /Task ID: " + taskid + ". Kindly login TMS on Intranet Portal to view the details.";
        body += "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><span style="mso-bidi-font-style:normal;font-style: italic;font-size: small;">This is a System generated message,";
        body += "kindly do not reply to this.<o:p xmlns:o="#unknown"></o:p></span>";



并发送邮件



and send mail

MailMessage m = new MailMessage("senderid", To);
                m.Subject = Subject;
                m.Body = Body;
                m.IsBodyHtml = true;
                m.From = new MailAddress(From);

                m.To.Add(new MailAddress(To));
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "mail.google.com";
              
                NetworkCredential authinfo = new NetworkCredential("seder@gmail.com", "pass123");
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = authinfo;
                smtp.Send(m);


请参阅我对相关问题的回答:
发送带有图片的HTML附件 [
Please see my answer to the related question:
Sending HTML attachment with images[^].

Actually, it answers a more general question: how to send multi-part e-mail with HTML part and graphics parts, and reference images in an HTML part. I think it''s good to know, too.

—SA


这篇关于如何使用带有嵌入式HTML TABLE的C#发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆