|
给你段代码,自己修改一下,应该能用:
Private Sub Test()
Dim Smail, Pword, Tmail, zhuti, zhengwen, fujian
Shell "regsvr32 /s " & ThisWorkbook.Path & "\Jmail.dll"
SendMail Smail, Pword, Tmail, zhuti, zhengwen, fujian
End Sub
Sub SendMail(username, password, SendTo, ByVal sSubject As String, ByVal sBody As String, ByVal sFileName As String)
Dim email
Set email = CreateObject("jmail.Message")
email.Charset = "gb2312"
email.Silent = False
email.Priority = 1
email.MailServerUserName = username
email.MailServerPassWord = password
email.FromName = username
email.From = username
email.Subject = sSubject
email.AddRecipient SendTo
email.body = sBody
If sFileName <> "" Then email.AddAttachment sFileName
email.send ("smtp.163.com")
email.Close
Set email = Nothing
End Sub |
|