asp.net

位置:IT落伍者 >> asp.net >> 浏览文章

ASP.NET 发邮件


发布日期:2019年09月26日
 
ASP.NET 发邮件

using Systemusing SystemCollectionsGenericusing SystemLinqusing SystemWebusing SystemWebUIusing SystemWebUIWebControlsusing SystemNetMailusing SystemNetpublic partial class _Default SystemWebUIPage { protected void Page_Load(object sender EventArgs e)

{ } protected void Button_Click(object sender EventArgs e)

{

MailMessage msg = new MailMessage()msgBody = thisTextBoxTextmsgFrom = new MailAddress(msgSubject = thisTextBoxTextmsgToAdd(

//SmtpClient sc = new SmtpClient( //SmtpClient sc = new SmtpClient(//scCredentials = new NetworkCredential(asdf//scSend(msg)msgIsBodyHtml = true //邮件默认格式是纯文本 //可发送超链接 如<a >百度</a> SmtpClient sc = new SmtpClient()scHost = scPort = NetworkCredential nc = new NetworkCredential()ncUserName = youxiangmingncPassword = mimascCredentials = ncstring filename = thisFileUploadFileNamethisFileUploadSaveAs(ServerMapPath(~/) + filename)Attachment att = new Attachment(ServerMapPath(~/) + filename)msgAttachmentsAdd(att)scSend(msg)} protected void Button_Click(object sender EventArgs e)

{ jmailMessage msg = new jmailMessageClass()msgSubject = thisTextBoxTextmsgBody = thisTextBoxTextmsgFrom = msgAddRecipient(msgMailServerUserName = youxiangmingmsgMailServerPassWord = mimamsgCharset = utf //显示汉字msgContentType = text/htmlmsgSend(}

上一篇:浅谈ASP.NET与HTML页面关系

下一篇:Asp.net 控件开发—数据回传