zoukankan
html css js c++ java
asp.net邮件发送
这里的邮件发送是指运行程序的服务器上已经安装了邮件服务器。如果用其他的邮件服务器不知道能不能发送。
还有这里用的发送邮件类是
System.Net.Mail.MailMessage
,而不是
System.Web.Mail .MailMessage
类,因为前面的类是新版本的类,我也鼓励大家用新类。
代码如下:
/**/
///
<summary>
///
发送邮件给供应商
///
</summary>
///
<param name="form"></param>
///
<param name="to"></param>
///
<param name="subject"></param>
///
<param name="body"></param>
///
<returns></returns>
public
void
SendEmailToSupplier(
string
from,
string
to,
string
subject,
string
body)
{
System.Net.Mail.MailMessage msg
=
new
System.Net.Mail.MailMessage();
msg.From
=
new
System.Net.Mail.MailAddress(from ,
"
新邮件
"
);
msg.To.Add(to);
msg.Subject
=
subject;
msg.Body
=
body;
msg.BodyEncoding
=
System.Text.Encoding.GetEncoding(
"
GB2312
"
);
msg.Priority
=
System.Net.Mail.MailPriority.High;
System.Net.Mail.SmtpClient cliect
=
new
System.Net.Mail.SmtpClient(
"邮件
服务器的IP
"
);
cliect.Credentials
=
new
System.Net.NetworkCredential(
"
mail_box
"
,
"
123456
"
);
cliect.Send(msg);
}
查看全文
相关阅读:
设计模式:生产者消费者模式
图解SSH原理
监听Google Player下载并获取包名等信息
android targetSdkVersion>=26收不到广播的处理
ant property file刷新不及时
maven的pom文件报错: must be "pom" but is "jar"
AJAX其实就是一个异步网络请求
String、StringBuffer、StringBuilder的区别
Properties、ResourceBundle
JavaWeb--Listener
原文地址:https://www.cnblogs.com/ringwang/p/991240.html
最新文章
开发中遇到的异常
随手记
继续折腾LNK 2005错误
如何监测耳机/麦克风设备插拔操作
php+gd库的源码安装
ldap
ssl配置
apache https配置
php正则
设计模式学习笔记十八:中介者模式
热门文章
设计模式学习笔记十七:状态模式
设计模式学习笔记十六:迭代器模式
设计模式学习笔记十五:命令模式
记一次线上性能优化
一次失败的动态转换bean的尝试与思考
HashMap原理分析
庄子·内篇·养生主第三
Java Annotation自定义注解详解
Why Reflection is slowly?(Trail: The Reflection API)
设计模式:六大设计原则
Copyright © 2011-2022 走看看