MailMessage newmail = new MailMessage(); newmail.From="*********@citiz.net"; newmail.BodyFormat=MailFormat.Html; newmail.Priority = MailPriority.High; newmail.To="[email protected]"; 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);这是发送的
ref: http://www.codeproject.com/info/search.asp?cats=3&cats=4&cats=5&cats=6&searchkw=pop+smtp&Submit1=Search&author=&sd=15+Nov+1999&ed=9+Jan+2007ps: search "pop" or "smtp" in www.codeproject.com to get samples
newmail.From="*********@citiz.net";
newmail.BodyFormat=MailFormat.Html;
newmail.Priority = MailPriority.High;
newmail.To="[email protected]";
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://www.codeproject.com/info/search.asp?cats=3&cats=4&cats=5&cats=6&searchkw=pop+smtp&Submit1=Search&author=&sd=15+Nov+1999&ed=9+Jan+2007ps:
search "pop" or "smtp" in www.codeproject.com to get samples
SmtpMail.SmtpServer="www.citiz.net";这句是不是应该改为SmtpMail.SmtpServer="localhost";
编译通不过,iis还需要配置smtp吗?
SmtpMail.SmtpServer="www.citiz.net";这句是不是应该改为SmtpMail.SmtpServer="localhost";
编译通不过,iis还需要配置smtp吗?
----------------------------
SmtpMail.SmtpServer="127.0.0.1或者你的内网IP";是要有smtp服务