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. PHP Mail 简介

    PHP mail() 函数用于从脚本中发送电子邮件. mail(to,subject,message,headers,parameters): 参数 描述 to 必需.规定 email 接收者. su ...

  2. 圆角button

    方案1: <Window.Resources> <ControlTemplate x:Key="CornerButton" TargetType="{x ...

  3. magento -- 添加新产品时状态默认为激活,库存状态默认为有库存

    添加新产品时状态默认为激活 打开文件/app/code/core/Mage/Catalog/Model/Product/Status.php,注释掉“Please Select” /** * Retr ...

  4. HDU 1004 Let the Balloon Rise(AC代码)

    #include <stdio.h> #include <string.h> ][]; ]={}; int main() { int n,i,j,k,max,loc; ){ m ...

  5. Oracle执行语句跟踪(1)——使用sql trace实现语句追踪

    系统上的某个接口提交数据经常超时(超过3秒),而我单独在后台数据库(Oracle)执行insert,只需要17ms.提交数据的客户端没有任何的调试日志,只能通过跟踪后台语句记录实际调用过程中的数据库执 ...

  6. Java--接口和类集框架

    一.接口 接口是静态常量和抽象方法的集合.也就是说,接口中只能有静态常量和抽象方法. public interface Pet { public static final int A = 10; pu ...

  7. CoreOS 835.12.0 稳定版安装

    导读 CoreOS是一个基于Docker的轻量级容器化Linux发行版,为Docker而生,CoreOS作为Docker生态圈中的重要一员,日益得到各大云服务商的重视,发展风头正劲. CoreOS宣称 ...

  8. relative与absolute的结合使用

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. JS开发者常用的10个Sublime Text插件

    Sublime Text 是每个开发者工具箱中都应该有的一个强大的应用.它是一个跨平台的.高定制化的.高级的文本编辑器,在功能强大的 集成开发环境(众所周知地消耗资源)和类似于 Vim 或 Emacs ...

  10. java List 排序 Collections.sort() 对 List 排序

    class User { String name; String age;  public User(String name,String age){  this.name=name;  this.a ...