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服务器,不用验证的话,就可以不用这几行了。
  • 相关阅读:
    c++的一些个学习及总结
    简单回合制游戏流程
    c++11 符号修饰与函数签名、函数指针、匿名函数、仿函数、std::function与std::bind
    二叉搜索树、平衡二叉树、红黑树
    STL之空间配置器
    centos 7 安装mysql及常用操作
    生产服务器问题定位
    Linux常用命令
    Garbage First(G1) 垃圾收集器
    垃圾回收算法和垃圾收集器
  • 原文地址:https://www.cnblogs.com/aowind/p/112695.html
Copyright © 2011-2022 走看看