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()}