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

问题描述

嗨...

如何每天从我的网站发送自动邮件


Hi...

how to send automatic mails daily from my website


thanks in advance..

推荐答案



public bool sandMail(string strTo, string strfrom,string password,string strSubject, string strBody)



{MailMessage mailObj = new MailMessage();
SmtpClient clientObj =新的SmtpClient();
clientObj.Credentials =新的System.Net.NetworkCredential(strfrom,密码);
clientObj.Host ="smtp.gmail.com";
clientObj.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
clientObj.EnableSsl = false;
clientObj.Port = 587;
MailAddress mailadTo =新的MailAddress(strTo);
MailAddress mailfrom = new MailAddress(strfrom,"rizwan");
mailObj.To.Add(mailadTo);
mailObj.From = mailfrom;
mailObj.Subject ="hi";
mailObj.IsBodyHtml = true;
clientObj.Send(mailObj);
返回true;
}



{ MailMessage mailObj=new MailMessage();
SmtpClient clientObj = new SmtpClient();
clientObj.Credentials = new System.Net.NetworkCredential(strfrom, password);
clientObj.Host = "smtp.gmail.com";
clientObj.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
clientObj.EnableSsl = false;
clientObj.Port = 587;
MailAddress mailadTo = new MailAddress(strTo);
MailAddress mailfrom = new MailAddress(strfrom, "rizwan");
mailObj.To.Add(mailadTo);
mailObj.From = mailfrom;
mailObj.Subject = "hi";
mailObj.IsBodyHtml = true;
clientObj.Send(mailObj);
return true;
}


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

10-20 10:36