求教:用asp.net自带的邮件发送类,发邮件时,怎么定义发件人的名称和发件人电子邮件地址
比如说:
我用zhangsn@126.com这个帐号作为邮件服务器发送邮件
但是我想别人看见邮件时,显示发件人“张三”,发件人电子邮箱“zhangsn@gmail.com”
请问应该怎么做??
------解决方案--------------------MailMessage newmail = new MailMessage();
newmail.From= "*********@citiz.net ";
newmail.BodyFormat=MailFormat.Html;
newmail.Priority = MailPriority.High;
newmail.To= "partsorder@sohu.com ";
newmail.Subject=subject;
newmail.Body=body;
newmail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 "); //basic authentication
newmail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", "username ");//set your username here
newmail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", "password ");//set your password here
MailAttachment attachment = new MailAttachment(saveName);
newmail.Attachments.Add(attachment);
SmtpMail.SmtpServer= "www.citiz.net ";
SmtpMail.Send(newmail);
------解决方案--------------------楼上正解
好象对反垃圾邮件的油箱不可以,
------解决方案--------------------个人看法 现在的邮件程序都发不出去
------------------------
http://fenglin.xland.cn
------------------------
------解决方案--------------------学习贴,mark一下!