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的邮件服务器发送,死活不可以!要不就是认证失败 ...
随机推荐
- Sublime Text 编译运行Kotlin
Sublime Text 编译运行Kotlin 转 https://blog.csdn.net/pirate7777777/article/details/72655293 kotlin最近是火了,所 ...
- 通过route指令指定笔记本同时连接外网和内网
假如你的外网网关是:X.X.X.X 内网网关:192.168.1.1 则在命令窗口输入以下两条命令: route add 0.0.0.0 mask 0.0.0.0 X.X.X.X route add ...
- iOS-上传头像的使用
static NSString *const uploadSuccess = @"更改头像成功"; @interface DMAccountInformationViewContr ...
- 针对thinkphp 5框架存储过程bug而重写的存储过程的扩展类
近期用tp5框架调取存储过程发现有bug,借鉴了一些官方的函数.以及找了个mysqli的类把存储过程重新写了个扩展类,下面两个类直接放置项目extend目录的stored(这个文件夹名称请按个人习惯命 ...
- godot新手教程2[godot常用代码用法]
Godot概念: 在godot内,使用的语言是GDScript,大部分代码风格是和python一样. 在GDScript内代码段结束是换到下一行即可,不需要也不能添加”;”号,(注意:代码段结束后不能 ...
- Goahead 编译
目录 Goahead 目录说明 Ubuntu编译 交叉编译 方便测试 参考 title: Goahead date: 2019/11/6 09:45:01 toc: true --- Goahead ...
- 第34课.数组操作符的重载("[]"重载)
1.问题:string类对象还具备c方式字符串的灵活性吗?还能直接访问单个字符吗? 答案:可以按照c字符串的方式使用string对象 string s = "a1b2c3d4e"; ...
- 《MIT 6.828 Homework 1: boot xv6》解题报告
本作业的网站链接:MIT 6.828 Homework 1: boot xv6 问题 Exercise: What is on the stack? While stopped at the abov ...
- RxJava基本使用
更多文章请点击链接:http://77blogs.com/?p=162 转载请标明出处:https://www.cnblogs.com/tangZH/p/12088300.html,http://77 ...
- Docker 安装 Tomcat
查找Docker Hub上的tomcat镜像 docker search tomcat 取官方的镜像 docker pull tomcat 使用tomcat镜像 创建目录tomcat,用于存放后面的相 ...