关于从远程服务器上的asp.net发送邮件 [英] regarding to sending mail from asp.net on remote server
本文介绍了关于从远程服务器上的asp.net发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
MailMessage mailMSG = new MailMessage();
SmtpClient myMail = new SmtpClient();
mailMSG.To.Add(new MailAddress(txtTo.Text));
mailMSG.From = new MailAddress(txtFrom.Text);
mailMSG.Subject = txtSubject.Text;
mailMSG.Body = txtContent.Value;
mailMSG.BodyEncoding = System.Text.Encoding.ASCII;
mailMSG.IsBodyHtml = true;
mailMSG.Priority = MailPriority.Normal;
myMail.UseDefaultCredentials = true;
myMail.Host = "127.0.0.1";
myMail.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
myMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
myMail.Send(mailMSG);
我在通过远程服务器http://xyx.in
发送邮件时遇到问题
怎么发送请回复我......请
I have problem to send mail with this at remote server http://xyx.in
how to send please reply me.........please
Thanks.
推荐答案
MailMessage mailMSG = new MailMessage();
SmtpClient myMail = new SmtpClient(yourSMTPhostaddress, your SMTP Port);
mailMSG.To.Add(new MailAddress(txtTo.Text));
mailMSG.From = new MailAddress(txtFrom.Text);
mailMSG.Subject = txtSubject.Text;
mailMSG.Body = txtContent.Value;
mailMSG.BodyEncoding = System.Text.Encoding.ASCII;
mailMSG.IsBodyHtml = true;
mailMSG.Priority = MailPriority.Normal;
myMail.Credentials = new NetworkCredential(specify MailUserName,specify MailPassword);
//if the SMTP server is SSL enabled(https)then set the Enable SSL property to //true otherwise set false
myMail.EnableSsl = true;
myMail.Send(mailMSG);
这篇关于关于从远程服务器上的asp.net发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文