zoukankan
html css js c++ java
[学习日记]记录听棠兄的EAMIL发送方法,改成vb.net可用
imports
system.web.mail
当然,在VS.net平台里用vb.net开发时,这个命名空间是不能直接用的,得先在引用中引用上system.web.dll
主要发送代码如下
Dim
mail
As
MailMessage
=
New
MailMessage
mail.
To
=
"
heqiang01@163.com,aowind@163.com"
mail.From
=
"
aowind@163.com"
mail.Subject
=
"
this is a test email."
mail.Body
=
"
<b>Some text goes here</b> "
mail.BodyFormat
=
MailFormat.Html
'
设置为HTML格式
mail.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate
"
,
"
1
"
)
'
设置为需要用户验证
mail.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendusername
"
,
"
aowind
"
)
'
设置验证用户名
mail.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendpassword
"
,
"xxxxxx
"
)
'
设置验证密码
SmtpMail.SmtpServer
=
"
smtp.163.com
"
'
邮件服务器地址
SmtpMail.Send(mail)
当然密码是不能写出来了,嘿嘿!
在mail.to这里所赋的值是收信人的地址,可以写多个,用","分隔就行了。
关键在于是需要身份验证的,所以红底这里几句就是实现身份验证的代码,感谢听棠兄。
当然自己架设的mail服务器,不用验证的话,就可以不用这几行了。
查看全文
相关阅读:
HDU 1394 Minimum Inversion Number
HDU 4931 Happy Three Friends
BZOJ 1089 严格n元树 (递推+高精度)
BZOJ 1088 扫雷Mine (递推)
BZOJ 3038 上帝造题的七分钟2 (并查集+树状数组)
BZOJ 3211 花神游历各国 (树状数组+并查集)
BZOJ 1087 互不侵犯King (位运算)
BZOJ 1002 轮状病毒 (基尔霍夫矩阵)
BZOJ 1005 明明的烦恼 (组合数学)
BZOJ 1058 报表统计 (STL)
原文地址:https://www.cnblogs.com/aowind/p/112695.html
最新文章
hdu 5055(模拟)
hdu 5054
hdu 5020(斜率的表示+STL)
mongodb 安装遇到问题:the domain,user name and/or password are incorrect.remember to use"." for the domain if the account is on the local machine
英语单词:前缀、后缀、词根---总结大全
kali 创建快捷方式的方法
不能安装vmtools解决:一个命令安装
LeetCode OJ:Integer to Roman(转换整数到罗马字符)
LeetCode OJ:Roman to Integer(转换罗马字符到整数)
条款23:宁以non-member, non-friend,替换member函数。
热门文章
LeetCode OJ:Lowest Common Ancestor of a Binary Tree(最近公共祖先)
LeetCode OJ:Add Digits(数字相加)
LeetCode OJ:Happy Number(欢乐数)
条款22:将成员变量声明为private
条款21:必须返回对象的时候,不要妄想使其返回reference
LeetCode OJ:Ugly Number(丑数)
LeetCode OJ:Count Primes(质数计数)
HDU 1005 Number Sequence
HDU 1754 I Hate It
HDU 3030 Increasing Speed Limits
Copyright © 2011-2022 走看看