jmail.Message Msg=new jmail.Message();
Msg.Logging=true;
//日志启用
Msg.Logging=true;
Msg.Silent=true;
//smtpserver用户名,密码
Msg.MailServerUserName="gl77"; 
Msg.MailServerPassWord="8562";
//邮件主题
Msg.Subject="测试";
//邮件内容
Msg.Body="测试";
Msg.Encoding="base64";
Msg.Charset="gb2312"; 
//发信人
Msg.From="[email protected]";
Msg.FromName="gl77";
//添加收信人
Msg.AddRecipient( "[email protected]","gl77","ok");
//优先级
Msg.Priority=3;
//添加附件
Msg.AddAttachment("d:\\新建 文本文档.txt",true,"txt");
if(Msg.Send("smtp.163.com",false))
Count.Text="ok"

解决方案 »

  1.   

    Imports jmail
    Imports System.Data
    Imports System.Data.SqlClient
    Module sendmail
      Public Overloads Function mail(ByVal strMailTo As String, ByVal strSubject As String, ByVal strHtml As String, ByVal intGrade As Integer) As Boolean
        Try
          Dim objMail As New Message()
          With objMail
            .Charset = "GB2312"
            .From = "***"
            .FromName = "***"
            .AddRecipient(strMailTo)
            .Subject = strSubject
            .AppendHTML(strHtml)
            .Priority = intGrade
            .Send("username:[email protected]")
            .Close()
          End With
          objMail = Nothing
          Return True
        Catch
          Return False
        End Try
      End Function