try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("your_email_address@gmail.com");
mail.To.Add("to_address");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL"; SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true; SmtpServer.Send(mail);
MessageBox.Show("mail Send");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}

How to send Email using C#的更多相关文章

  1. Try to write a script to send e-mail but failed

    #-*-coding: utf-8 -*- '''使用Python去发送邮件但是不成功,运行后,等待一段时间, 返回[Errno 10060] A connection attempt failed ...

  2. python auto send email

    /*************************************************************************** * python auto send emai ...

  3. Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email

    Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email. (文档 I ...

  4. Send Email in Robot Framework Python Using Gmail

    转载自:http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-fra ...

  5. 5 Ways to Send Email From Linux Command Line

    https://tecadmin.net/ways-to-send-email-from-linux-command-line/ We all know the importance of email ...

  6. [476] Database Mail is not enabled for agent notifications. Cannot send e-mail to

    配置完DB Mail后JOB的的通知邮件不能发送,日志报错476] Database Mail is not enabled for agent notifications. Cannot send ...

  7. Send email alert from Performance Monitor using PowerShell script (检测windows服务器的cpu 硬盘 服务等性能,发email的方法) -摘自网络

    I have created an alert in Performance Monitor (Windows Server 2008 R2) that should be triggered whe ...

  8. Send Email

    private string SendEmail(string mailTo, string body, ref int sendresult) { string errorEmailAddress ...

  9. .Net Core Send Email

    1.安装Nuget包MailKit,引用命名空间. using MailKit.Net.Smtp; using MimeKit; 注意:引用MailKit对应最新版本 2.定义收发地址和标题 Mime ...

随机推荐

  1. Windows桌面快捷方式图标全部变成同一个图标的解决方法

    今天来个客人,说是电脑的所有程序打开都变成 Adobe Reader 了,打开看了下,刚开始是以为EXE文件关联被修改了,用注册表修复工具弄了下,重启电脑,还是老样子.仔细看了下,原来只是快捷方式变成 ...

  2. 谷歌、火狐浏览器gift图片缓存后不显示动态效果

    <script> $(function(){ $('.center img').prop("src","images/service/01.gif" ...

  3. [转载]Magento 店铺多语言设置

    本文以扩展中文包为例: 首先进入自己 Magento 后台 系统 -> 管理商店(System -> Manage Stores) 单击 “创建店铺视图”(Create Store Vie ...

  4. 如何在Apache中建立一个新端口

    环境: Windows server 2008 R2, Apache, PHP5 步骤: 建立一个目录,里面放置一个index.php. 打开Apache\conf\httpd.conf 文件,做如下 ...

  5. uninstall gitlab

    Stop gitlab and remove its supervision process sudo gitlab-ctl uninstall Debian/Ubuntu sudo dpkg -r ...

  6. js之阻止事件冒泡(待修改)和阻止默认事件

    阻止默认事件(event.stopPropagation()): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...

  7. TreodeDB测试及总结

    参考资料:http://treode.github.io/store/ 官方网站 实际测试环境:3台有公网IP的服务器,一台阿里云,另两台公司内部 1host IP地址 IP1java -jar se ...

  8. my Style

    1. box-sizing语法: box-sizing : content-box || border-box || inherit 参数取值: content-box:此值为其默认值,其让元素维持W ...

  9. leetcode 149. Max Points on a Line --------- java

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  10. Codeforces Round #145 (Div. 2, ACM-ICPC Rules)

    A. Lefthanders and Righthanders \(i\)与\(i+\frac n2\)匹配,根据左右手调整位置. B. Reading 排序,取前\(k\)个. C. Weather ...