1

SMTPサーバーとしてGoogleAppsアカウントを使用して、従来の従来のaspスクリプトから連絡先の問い合わせメールを送信しようとしています。これをテストする必要があるコードは次のとおりです。

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") ="info@thedomain.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 = "me@mydomain.net"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "info@thedomain.com"

' 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の両方を試しました。SMTPサーバーとしてmail.thedomain.comとsmtp.thedomain.com、mail.gmail.comとsmtp.gmail.comを試しましたが、何も機能しません。スクリプトにメールアドレスとパスワードを使用してGoogleAppsアカウントにログインしたので、これらの詳細は間違いなく正しいです。

私が得ることができるのは、次のエラーだけです。

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/_test-email.asp, line 46 

(46行目はObjSendMail.Sendと書かれているところです)

誰かが何が間違っているのかわかりますか?

皆さん、ありがとう!

4

2 に答える 2

3

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
于 2012-03-26T17:17:28.583 に答える
1

(true)に設定smtpusesslしてみてください(設定されているようです)1false

于 2012-03-12T15:35:02.753 に答える