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);
}
查看全文
相关阅读:
7387. 【2021.11.16NOIP提高组联考】数析送命题
js 数组的基本操作
界面跳转已打开界面强制刷新
Topshelf安装Windows服务
np_utils.to_categorical
SQLServer数据库的.ldf文件太大怎办?
Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法!
[学习笔记]设计模式之Factory Method
[学习笔记]设计模式之Singleton
[学习笔记]设计模式之Abstract Factory
原文地址:https://www.cnblogs.com/ringwang/p/991240.html
最新文章
Windows 2008 R2下安装Exchange 2010 (14.0.639.21)的必要条件
自动化测试的7个步骤(转)
装饰模式
代理模式
策略模式与工厂结合(实现商场收银效果)
策略模式原型
解决编译Apache出现的问题:configure: error: APR not found . Please read the documentation
C++中如何定义函数对象
C++中的函数指针和函数对象总结
AJAX JSONP JSON XML
热门文章
HTML5新API
vue总结
js基础总结
设计模式之单例模式与策略模式
http缓存
HTML与css杂项
版本控制 调试测试
对象拷贝与继承
7391. 【2021.11.17NOIP提高组联考】图
7385. 【2021.11.15NOIP提高组联考】你
Copyright © 2011-2022 走看看