2012-03-12 30 views
0

Google AppsアカウントをSMTPサーバーとして使用して従来の古典的なaspスクリプトから連絡先の電子メールを送信しようとしています。次のように私はこれをテストする必要があるコードは次のとおりです。Google Apps経由でCDOでメールを送信すると転送エラーが発生する:CDO.Message.1エラー '80040213'

Dim ObjSendMail 
Set ObjSendMail = CreateObject("CDO.Message") 

'This section provides the configuration information for the remote SMTP server. 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network). 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.thedomain.com" 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 ' or 587 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 

' Google apps mail servers require outgoing authentication. Use a valid email address and password registered with Google Apps. 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]domain.com" 'your Google apps mailbox address 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password" 'Google apps password for that mailbox 

ObjSendMail.Configuration.Fields.Update 

ObjSendMail.To = "[email protected]" 
ObjSendMail.Subject = "this is the subject" 
ObjSendMail.From = "[email protected]" 

' we are sending a text email.. simply switch the comments around to send an html email instead 
'ObjSendMail.HTMLBody = "this is the body" 
ObjSendMail.TextBody = "this is the body" 

ObjSendMail.Send 
Set ObjSendMail = Nothing 

は私が試した465と587の両方のポート番号を試してみたmail.thedomain.comとsmtp.thedomain.comとmail.gmail.com smtp.gmail.comをSMTPサーバーとして使用していますが、何も動作しません。スクリプト内にメールアドレスとパスワードを使ってGoogle Appsアカウントにログインしているので、これらの詳細は間違いありません。

すべて私も取得することができ、次のエラーです:

CDO.Message.1 error '80040213' 

The transport failed to connect to the server. 

/_test-email.asp, line 46 

(それはObjSendMail.Send言うところのライン46がある)

誰が間違っているかもしれないものを見ることができますか?

ありがとうございました!

+0

@Calonは...同じようにすべての質問を編集 – AlvaroAV

答えて

2

私はGmailの SMTPサーバとあなたのコードを少し変更してみました、それが魅力のように働きました。

これら3つのパラメータを変更するだけでよいです。

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.gmail.com" 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 
1

(真)1smtpusesslを設定してみてください(私はあなたがそれをfalseに設定されている参照)

+0

感謝を停止 - 私はあまりにもそのフィールドの真と偽(と1と0)の両方を試した言及を忘れてしまったが、それでも取得します同じエラー。ローカルホスト(何らかの種類のファイアウォールの問題や 'mail.thedomain.com'アドレスがローカルにルーティングされて接続されていないのですか?)と何か関係がありますか?サーバー管理者とホスティング会社についてはわかりません( – Dan

+4

私はGoogle Appsアカウント「smtpserver = "smtp.gmail.com"、smtpserverport = 465、smtpusessl = 1'でそれをテストしました。あなたの最後にファイアウォールの問題を示唆していますか? – HeavenCore

関連する問題