0
asp.net에서 asp classic으로 웹 페이지를 업그레이드하는 중입니다. 이전 코드에서는 CDO를 사용하여 전자 메일을 보냈습니다.대상 컴퓨터가 적극적으로 거부했기 때문에 연결할 수 없습니다.
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2
.Item(sch & "smtpserver") = "mail.mydomain.com"
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
strTo = "[email protected]"
strFrom = "[email protected]"
strSubject = "email subject"
strBody = strBody & "This is the email body"
With cdoMessage
Set .Configuration = cdoConfig
.From = strFrom
.To = strTo
.Subject = strSubject
.HTMLBody = strBody
.Send
End With
Set cdoConfig = Nothing
Set cdoMessage = Nothing
이 코드는 정상적으로 작동하지만 내 asp.net 페이지에서 전자 메일을 보내려합니다. .net 페이지에서 보낼 때 "대상 컴퓨터가 xx.xx.xxx.xxx:2를 적극적으로 거부했기 때문에 연결할 수 없습니다"
내 web.config 설정 :
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="mail.mydomain.com" port="2"/>
</smtp>
</mailSettings>
</system.net>
그리고 나에게 오류를주고있다 코드의 섹션 :
Dim mailmsg As New MailMessage("[email protected]", txtSubmitterEmail.Text)
mailmsg.Subject = "subject here"
mailmsg.Body = "mail body here"
mailmsg.IsBodyHtml = True
Dim smtp As New SmtpClient
smtp.Send(mailmsg)
나는 닷넷 오히려 새로운 해요하지만 난 시간 동안 검색 한 내용과 이유를 가지고 올 수없는 이유 이전을 코드는 작동하지만 새로운 코드는 작동하지 않습니다. 도움에 미리 감사드립니다!
OP가 누락 된 경우 : 오류 메시지가 "xx.xx.xxx.xxx:2"를보고하면 마지막 번호가 포트 번호입니다. SMTP는 일반적으로 포트 25에 있습니다. – Bevan
감사! 그게 효과가 있었어. CDO를 사용하는 코드가 포트 2를 사용 중이기 때문에 포트 25를 시도하지 않았습니다. – zeroef