2012-10-10 20 views
5

VBScript CDO'sunun Amazon SES SMTP ile çalışmasını sağlamanın bir yolu var mı? Herhangi bir hata alamıyorum, ama bana test e-postamı da göndermiyor. SSL'yi False olarak değiştirmek bana 530 hatası veriyor, bu yüzden en azından sunucuya ulaştığımı biliyorum. Neyi yanlış yapıyorum?VBScript CDO'sunun Amazon SES SMTP ile çalışmasını sağlamak için bir numara var mı?

EmailSubject = "Sending Email by CDO" 
EmailBody = "This is the body of a message sent via" & vbCRLF & _ 
     "a CDO.Message object using SMTP authentication." 

Const EmailFrom = "[email protected]" 
Const EmailFromName = "Me Test" 
Const EmailTo = "[email protected]" 
Const SMTPServer = "email-smtp.us-east-1.amazonaws.com" 
Const SMTPLogon = "xxxxxx" 
Const SMTPPassword = "xxxxxxx" 
Const SMTPSSL = True 
Const SMTPPort = 25 

Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory. 
Const cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking. 

Const cdoAnonymous = 0 ' No authentication 
Const cdoBasic = 1 ' BASIC clear text authentication 
Const cdoNTLM = 2 ' NTLM, Microsoft proprietary authentication 

' First, create the message 

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = EmailSubject 
objMessage.From = """" & EmailFromName & """ <" & EmailFrom & ">" 
objMessage.To = EmailTo 
objMessage.TextBody = EmailBody 

' Second, configure the server 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPLogon 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = SMTPSSL 

objMessage.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 

objMessage.Configuration.Fields.Update 

' Now send the message! 

objMessage.Send 

cevap

7

CDO, TLS'yi desteklemez, yalnızca SSL'dir. AWS SES, TCP'yi 465 numaralı TCP bağlantı noktası üzerinden kullanmanıza izin verecektir. Gönderdiğiniz komut dosyasında olduğu gibi 25 numaralı bağlantı noktasından SSL'yi kullanmaya çalıştığınızda, aşağıdaki hata iletisini döndürmeniz gerekir:

CDO.Message.1: Aktarım bağlantıyı kaybetti. sunucu.

Bu betikle neden bu hatayı almıyorsunuz bilmiyorum. Ben yaparım. Bağlantı noktasını 465 olarak değiştirmeyi deneyin. Bağlantı noktasını 465 olarak değiştirdiğimde çalışır.

0

Bu harika bir rutindir. O İnş kullanıyor beri bu öğelerin herhangi birini değiştirmek istiyorsanız, siz bunları dize olarak ilan edip kaldırmak gerekir,

Dim objMessage Nesnesi olarak

Ayrıca: Bir nesne olarak objMessage ilan etmek gerek Bu çizgilerden sağla. SMTPPort için 465 yerine SES id/pw kullanmalı ve mükemmel çalışıyor!

İlgili konular