本文介绍了发送邮件asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用asp.net发送sendig电子邮件,请帮帮我吗?

i want sendig email with asp.net please help me?

推荐答案



MailAddress mailfrom = new MailAddress ( "[email protected]" );
MailAddress mailto = new MailAddress ( "[email protected]" );
MailMessage newmsg = new MailMessage ( mailfrom, mailto );

newmsg.Subject = "Subject of Email";
newmsg.Body = "Body(message) of email";

////For File Attachment, more file can also be attached

//Attachment att = new Attachment ( "G:\\code.txt" );
//newmsg.Attachments.Add ( att );

SmtpClient smtps = new SmtpClient ( "smtp.gmail.com", 587 );
smtps.UseDefaultCredentials = false;
smtps.Credentials = new NetworkCredential ( "[email protected]", "urpwd" );
smtps.EnableSsl = true;
smtps.Send ( newmsg );


这篇关于发送邮件asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:53