c#向指定的邮箱发送邮件
private bool SendEmail(string fileName)
{
MailMessage m_Mail = new MailMessage();
m_Mail.From = new MailAddress(ConfigurationManager.AppSettings["MailFrom"]);
string m_MailToStr = ConfigurationManager.AppSettings["MailTo"];
string m_MailServer = ConfigurationManager.AppSettings["MailServer"];
string[] m_MailToList = m_MailToStr.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = ; i < m_MailToList.Length; i++)
{
m_Mail.To.Add(new MailAddress(m_MailToList[i]));
}
m_Mail.Subject = "Pending Fund List";
m_Mail.Body = "Please find the attachment for the Pending Funds List while it is ID, OP & Perf ready. ";
m_Mail.IsBodyHtml = true;
m_Mail.BodyEncoding = System.Text.Encoding.UTF8;
Attachment m_MailAttach = null;
if (!string.IsNullOrEmpty(fileName))
{
m_MailAttach = new Attachment(fileName);
m_Mail.Attachments.Add(m_MailAttach);
}
SmtpClient client = new SmtpClient(m_MailServer);
try
{
client.Send(m_Mail);
if (m_MailAttach != null)
m_MailAttach.Dispose();
return true;
}
catch (Exception e)
{
//_log.Error(e.Message);
return false;
}
}
c#向指定的邮箱发送邮件的更多相关文章
- centos7 使用指定邮箱发送邮件
一.安装sendmail与mail .安装sendmail: ) centos下可以安装命令:yum -y install sendmail ) 安装完后启动sendmail命令:service se ...
- asp.net使用qq邮箱发送邮件
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Ne ...
- legend3---lavarel中使用qq邮箱发送邮件
legend3---lavarel中使用qq邮箱发送邮件 一.总结 一句话总结: 第一步:配置邮箱做服务器,比如qq邮箱,网易163邮箱 第二步:配置lavarel的配置文件 第三部:写邮件发送代码就 ...
- 杂项之使用qq邮箱发送邮件
杂项之使用qq邮箱发送邮件 本节内容 特殊设置 测试代码 1. 特殊设置 之前QQ邮箱直接可以通过smtp协议发送邮件,不需要进行一些特殊的设置,但是最近使用QQ邮箱测试的时候发现以前使用的办法无法奏 ...
- DEDECMS会员注册如何配置邮箱发送邮件功能
网站邮件功能是一个非常基础和有效的通信工具,配合dede会员注册邮件验证功能可以大量的拒绝垃圾注册用户.那么如何配置DEDECMS会员注册邮箱发送邮件功能? 1:配置dedecms网站发信EMAI ...
- 126邮箱发送邮件python实现
126邮箱发送邮件python实现 from email.mime.text import MIMEText from email.utils import formataddr import smt ...
- ecshop QQ邮箱发送邮件服务器配置
ecshop QQ邮箱发送邮件服务器配置 1.邮件服务:采用其他的SMTP服务 2.邮件服务器是否要求加密连接(SSL): 是 此项设置需要php支持openSSL模块 开启方法: a.php.ini ...
- 基于JavaMail向邮箱发送邮件
参考:http://blog.csdn.net/ghsau/article/details/17839983 http://blog.csdn.net/never_cxb/article/detail ...
- rails使用QQ邮箱发送邮件蛋疼的经历
以前本猫在blog中写过使用ruby发送邮件的博文,其中使用了163和qq的邮箱发送邮件都可以发送成功.但是现在使用rails的发送邮件功能,使用的是qq的邮件服务器发送,死活不可以!要不就是认证失败 ...
随机推荐
- C之结构体
#include<stdio.h> #include<stdlib.h> void study(){ printf("好好学习,天天向上 \n"); } / ...
- 七天学会ASP.NET MVC
地址一: http://www.cnblogs.com/powertoolsteam/p/MVC_one.html http://www.cnblogs.com/powertoolsteam/p/MV ...
- 修改IDEAL 快捷键风格
选择File------Setting-----进入到设置窗口-------keymap--------选择自己适应的快捷键风格 选择Eclipse后Ideal的快捷键就和Eclipse相同
- 使用STM32F103ZET霸道主板实现LCD显示屏显示
简单了解液晶显示屏 液晶显示屏LCD是靠背光LED发光,然后经过横竖透光,每个点电压可以改变光线的方向,总之能改变透光度0-100%,最后就是每个像素点对应红绿蓝RGB,RGB各自的亮度不同,组成的颜 ...
- OPC Utgard的数据访问方式
1.同步读取某个点位的值 Item项的read()方法 Server server = new Server(BaseConfiguration.getCLSIDConnectionInfomatio ...
- [Agc029B]Powers of two_贪心_树形dp
Powers of two 题目链接:https://atcoder.jp/contests/agc029/tasks/agc029_b 数据范围:略. 题解: 可能一点思路都没有. 但是我们发现:如 ...
- java源码--Vector和Stack
一.Vector简介 1.1.Vector概述 通过API中可以知道: 1)Vector是一个可变化长度的数组 2)Vector增加长度通过的是capacity和capacityIncrement这两 ...
- DP_Milking Time
Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that sh ...
- CentOS7 PHP cURL errno 35, 原因:CentOS7中没有安装curl和OpenSSL的最新版
安装OpenSSL的最新版 话不多说,直接上安装步骤 #cd /usr/local/src # 跳过证书获取失败 # wget https://www.openssl.org/source/opens ...
- 如何找到程序的真正入口mainCRTStartup
相信大家都知道以为程序的入口为main函数,但是程序的真正的入口不是main而是mainCRTStartup,那么我们如何找到他的地址呢? 先用第一种方法,就是直接代码显示 #include<s ...