2012-11-23 2 views
0

CDO를 사용하여 전자 메일로 양식의 세부 정보를 보내는 ASP 페이지가 있습니다. 지금까지, 나는 SMTP 서버에 대한 명확한 연결을 통해 smtp 포트 25를 사용했다.SSL 연결을 사용하여 CDO 전자 메일 보내기

이제 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 

사람이 잘못 될 수있는 아이디어가 있습니까?

감사합니다.

답변

0

이 게시물은 약간 오래된 것입니다. 이미 해결 했습니까?

그렇지 않은 경우 일반 메시지 500 이외의 오류 메시지를 제공 할 수 있습니까?

난 단지 실제 오류 메시지를 보지 않고이 개 가능한 아이디어를 가지고 : 그것은 시간 초과 할 수

1). myMail.Configuration.Fields.Item을 추가하십시오. ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

2) "127.0.0.1"과 인증서가 일치하지 않습니다. "IP 주소 및 SSL 통신을 거부하고 있습니다.

2

레거시 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