使用带有CDO的VB中的Amazon SES发送 - 无法发送:
知道我们做错了吗?
Call SendEmail
Sub SendEmail()
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoReturnReceiptTo = "urn:schemas:mailheader:return-receipt-to"
Const cdoBasic = 1 'basic (clear-text) authentication
On Error Resume Next
Dim objFSO, objTextFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("c:\temp\Emails\RS_15031605_XENCO2_20150323_163107.log", True)
Set objMessage = CreateObject("CDO.Message")
If err.Number <> 0 Then
objTextFile.WriteLine("[result=-1](" & err.Description & ")")
objTextFile.Close
Exit Sub
End If
objMessage.Subject = "test message"
objMessage.From = """LIMS Administrator"" <reporting@clientdomain.com> "
objMessage.ReplyTo = "Client name <reporting@clientdomain.com>"
objMessage.Fields(cdoReturnReceiptTo) = "Client name <reporting@clientdomain.com>"
objMessage.Fields.Update
objMessage.To = "email@domain.com"
objMessage.CC = "email@domain.com"
objMessage.TextBody = "Test"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "email-smtp.us-east-1.amazonaws.com"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "VALIDAMAZONSESUSERNAMELOOKSLIKETHIS->ygyg66Ygyg987g8yg987g"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*******VALIDAMAZONSESPASSWORDHERE**************"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
If err.Number <> 0 Then
objTextFile.WriteLine("[result=-2](" & err.Description & ")")
objTextFile.Close
Exit Sub
End If
objTextFile.WriteLine("[result=0]()")
objTextFile.Close
End Sub