平平是寄信~~這個可以指定送信的伺服器
bHTML=True
cdoSEndUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sEndusing"
cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
cdoSEndUserName = "http://schemas.microsoft.com/cdo/configuration/sEndusername"
cdoSEndPassword = "http://schemas.microsoft.com/cdo/configuration/sEndpassword"
cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
cdoSMTPAuThenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauThenticate"
Err.Clear
On Error Resume Next
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
With Flds
.Item(cdoSEndUsingMethod) = 2 ' cdoSEndUsingPort
.Item(cdoSMTPServer) = "<<指定寄送郵件伺服器>>" 'ex:smtp.pchome.com.tw
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
.Item(cdoSMTPAuThenticate) = 1
.Item(cdoSEndUserName) = "<<SMTP的帳號>>"
.Item(cdoSEndPassword) = "<<SMTP的密碼>>"
.Update
End With
With iMsg
Set .Configuration = iConf
.From = "<<寄件者電子信箱>>"
.To = "<<收件者電子信箱>>"
.Bcc = "<<副本電子郵件>>"
.Subject = "<<主旨>>"
If bHTML=True Then
.HTMLBody = "<<寄送內容為HTML>>"
Else
.TextBody = "<<寄送內容為純文字>>"
End If
.ReplyTo = "<<回覆到那個電子郵件>>"
.Send
End With
Set iConf = Nothing
Set iMsg = Nothing