如何发送smtp邮件 [英] how to send an smtp mail
本文介绍了如何发送smtp邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我需要有关如何发送带密码加密的smtp邮件的详细代码。
Hi I need detailed code for how to send an smtp mail with password encryption.
推荐答案
请看这里:使用或不使用附件在C#中发送电子邮件:通用例程。 [< a href =http://www.codeproject.com/Tips/163829/Sending-an-Email-in-C-with-or-without-attachmentstarget =_ blanktitle =New Window> ^ ]
亲爱的,
查看此解决方案。
Hi dear,
Check this solution.
private void MailSend()
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
SmtpServer.Host = "smtp.gmail.com";
mail.From = new MailAddress("FromMailName@gamil.com");
mail.To.Add("ToMailName@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("ToMailName@gmail.com", "123456"); // User Mail Name And Mail Password
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
使用C#通过SMTP发送邮件 [ ^ ]
配置服务器SMTP IIS以发送邮件 [ ^ ]
..更多关于 google [ ^ ]
Sending Mail Using C# via SMTP[^]
Config the Server SMTP IIS to send Mail[^]
..and lot more on google[^]
这篇关于如何发送smtp邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文