public ActionResult SendMail()
{
MailMessage mss = new MailMessage();
mss.From = new MailAddress("Grace_cai01@infosys.com");
mss.Body = "testtesttesttesttest";
mss.BodyEncoding = Encoding.UTF8;
mss.IsBodyHtml = false;
mss.To.Add(new MailAddress("Grace_cai01@infosys.com"));
SmtpClient cliente = new SmtpClient();
cliente.Host = ConfigurationManager.AppSettings["Host"].ToString();
cliente.Port = int.Parse(ConfigurationManager.AppSettings["Port"].ToString());
cliente.UseDefaultCredentials = ConfigurationManager.AppSettings["EnableSsl"].ToString() == "" ? false : true;
cliente.EnableSsl = false;
string Username = ConfigurationManager.AppSettings["Username"].ToString();
string Password = ConfigurationManager.AppSettings["Password"].ToString();
System.Net.NetworkCredential credenciais =
new System.Net.NetworkCredential(Username, Password);
cliente.Credentials = credenciais;
cliente.Send(mss);
return Content("ok");
}

SendMail的更多相关文章

  1. centos 6.6 系统中配置sendmail和dovecot

    网上介绍sendmail的文章千百种,很少有跟着做下来一次成功的.多少都有些说的不准确的地方. 我给大家共享一下我经过实验环境测试,完全可行的方法. 1.软件准备 操作系统:centos6.6我选择c ...

  2. 如何利用sendmail发送外部邮件?

    在写监控脚本时,为了更好的监控服务器性能,如磁盘空间.系统负载等,有必要在系统出现瓶颈时,及时向管理员进行报告.在这里通常采用邮件报警,同时,邮件设置为收到邮件,即向指定手机号码发送短信.这样可以实现 ...

  3. Linux 通过sendmail 发邮件到外部邮箱

    最近在写自动化巡检脚本,想着怎么预警后自动发送邮件报警. 首先下载最新版本mailx-12.4.tar.bz2 # wget http://sourceforge.net/projects/heirl ...

  4. Red Hat Enterprise Server 6.0 安装Sendmail相关包

    由于需要在Linux服务器(Red Hat Enterprise Linux Server release 6.0)上配置邮件服务,需要安装Sendmail包,一般Sendmail的安装有两种方式:R ...

  5. Linux sendmail发送邮件失败诊断案例(一)

    在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查日志文件发现如下错误(Notice:由于涉及公司服务器,邮箱等,故下面hostname.邮箱地址等信息使用xxx代替) tail - ...

  6. Linux SendMail发送邮件失败诊断案例(二)

    Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理.收集了一些邮件发送失败.异常的案例. 案例1:在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查/var ...

  7. postfix与sendmail冲突

    在Linux服务器(CentOS release 6.6)上配置好了sendmail后,测试发送邮件时发现有问题,检查sendmail服务的状态,发现其处于"sendmail dead bu ...

  8. Linux SendMail服务启动慢总结

    在 CentOS release 6.6 上启动sendmail服务时发现服务启动过程非常慢,基本上要耗费3分多钟.有点纳闷:什么原因导致sendmail启动这么慢?搜索了这方面的一些资料,结合自己的 ...

  9. linux系统下sendmail的搭建

    学习鸟哥linux私房菜所得 sendmail 可以使用rpm -qa |grep sendmail来查看一下是否已安装sendmail-cf和sendmail 如果没有安装可用yum -y inst ...

  10. PHP (sendmail / PHPMailer / ezcMailComposer)发送邮件

    一. 使用 PHP 内置的 mail() 函数 1. Windows 下 环境:WampServer2.5(Windows 10,Apache 2.4.9,MySQL 5.6.17,PHP 5.5.1 ...

随机推荐

  1. How to easily concatenate text based on criteria in Excel? 如何将Excel中的文本按条件合并

    To combine text with the unique ID numbers, you can extract the unique values first and then create ...

  2. [ES7] Descorator: evaluated & call order

    When multiple decorators apply to a single declaration, their evaluation is similar to function comp ...

  3. [Javascript + rxjs] Introducing the Observable

    In this lesson we will get introduced to the Observable type. An Observable is a collection that arr ...

  4. 详解Android动画之Frame Animation

    在开始实例讲解之前,先引用官方文档中的一段话: Frame动画是一系列图片按照一定的顺序展示的过程,和放电影的机制很相似,我们称为逐帧动画.Frame动画可以被定义在XML文件中,也可以完全编码实现. ...

  5. android 73 下载图片

    package com.ithiema.imageviewer; import java.io.InputStream; import java.net.HttpURLConnection; impo ...

  6. PureMVC(JS版)源码解析(二):Notification类

    上篇博客,我们已经就PureMVC的设计模式进行的分析,这篇博文主要分析Notification(消息)类的实现. 通过Notification的构造函数可以看出,PureMVC中的Notificat ...

  7. Java基础知识强化之集合框架笔记56:Map集合之HashMap集合(HashMap<String,Student>)的案例

    1. HashMap集合(HashMap<String,Student>)的案例 HashMap是最常用的Map集合,它的键值对在存储时要根据键的哈希码来确定值放在哪里. HashMap的 ...

  8. dubbo注册服务IP解析异常及IP解析源码分析

    在使用dubbo注册服务时会遇到IP解析错误导致无法正常访问. 比如: 本机设置的IP为172.16.11.111, 但实际解析出来的是180.20.174.11 这样就导致这个Service永远也无 ...

  9. 禁止输出重定向(>)覆盖已存在文件(防止误操作)

    在输出重定向中,>表示重定向并覆盖已有文件内容,为了防止误操作,覆盖重要的内容,可以使用如下命令: set -C 这样输出重定向到一个已有文件就会提示: cannot overwrite exi ...

  10. Andriod中WebView加载登录界面获取Cookie信息并同步保存,使第二次不用登录也可查看个人信息。

    Android使用WebView加载登录的html界面,则通过登录成功获取Cookie并同步,可以是下一次不用登录也可以查看到个人信息,注:如果初始化加载登录,可通过缓存Cookie信息来验证是否要加 ...