3

CDO を使用してフォームの詳細を電子メールで送信する ASP ページがあります。これまでのところ、hmail サーバーへのクリア接続を介して smtp ポート 25 を使用してこれを行ってきました。

ここで、SSL 接続を使用する必要があります。セキュリティ証明書を作成し、ポート 465 と ssl を使用するように hmail サーバーを設定しました。

しかし、フォームを送信しようとすると、何らかの理由でエラー 500 が表示され、メールが送信されません。

ポート 587 でも試しましたが、どちらも機能しません。

私が使用する CDO コードは次のとおりです。

If request.Form("submit") <> "" then

Set myMail=CreateObject("CDO.Message")
myMail.Subject="xxxxxxx"
myMail.From=Request.Form("email")
myMail.To= "xxxxxxxxxxx"

myMail.TextBody = "Name:"& Request.Form("name")& vbcrlf & vbcrlf & _

"Email:" & Request.Form("email") & vbcrlf & vbcrlf &  _

"Telephone:" & Request.Form("telephone") & vbcrlf & vbcrlf & _

"Location:" & Request.Form("location") & vbcrlf & vbcrlf & _

"Other location:" & Request.Form("other_location") & vbcrlf & vbcrlf & _

"Comments:" & Request.Form("comments")

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="127.0.0.1"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=465
MyMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

誰が何が間違っているのか考えていますか?

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

4

2 に答える 2

5

レガシ ASP コードで同じ問題が発生しました。次のコードは Amazon で動作します。注: ポート 25 または 465 のみが機能しているようで、smtpusessl = 1 (VBScript では True==-1)

' Create Connection
Function GetEmailConnection ()
    Set oMail = CreateObject("CDO.Message")
    Set GetEmailConnection = oMail
End function
Function GetConfiguration()
    Set oConfig = CreateObject("CDO.Configuration")
    Set GetConfiguration = oConfig  
End Function

' Send Email

    Sub SendEmail (subject, fromAddress, toAddress, body)
        set objMessage = GetEmailConnection()


    Set objConfiguration = GetConfiguration()

    Set fields = objConfiguration.Fields

    Const cdoSendUsingPort = 2

    With fields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "email-smtp.us-east-1.amazonaws.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ' 
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic 
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
    .Update
    End With
    With objMessage
    set .Configuration = objConfiguration
    .Subject = subject 
    .From = fromAddress 
    .To= toAddress
    .TextBody = body
    .Send
    End With
    set objMessage = nothing        
end Sub
于 2013-06-23T19:36:53.273 に答える
0

この投稿は少し古いですが、すでに解決しましたか?

そうでない場合は、エラーメッセージ(汎用500以外)を提供できますか?

実際のエラーメッセージが表示されない場合、考えられるアイデアは2つだけです。

1)タイムアウトしている可能性があります。myMail.Configuration.Fields.Item _( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")=60を追加してみてください

2)「127.0.0.1」のIPアドレスと証明書が一致していないため、SSL通信が拒否されている可能性があります。

于 2012-12-13T05:11:35.713 に答える