Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

SMTP server - message could not be sent

$
0
0
Hello,

I'm using vb6.0 and CDO's for sending email.[Windows7]
The below code working good for gmail, yahoo, nate.
It's not working for Hotmail, naver, daum.net

I'm getting below error:
Run-time error '2147220975(80040211)':
The message could not be sent to the SMTP server.
the transport error code was 0x80040217.
the server response was not available.


naver : SendEmail("smtp.naver.com", "465", "2", "myNaverID@naver.com", "pwd", "subj-naver")
Hotmail : SendEmail("smtp.live.com", "587", "2", "myHotmail@naver.com", "pwd", "subj-hotmail")
Daum : SendEmail("smtp.daum.net", "465", "2", "myDaumID@naver.com", "pwd", "subj-daum")


Code:

Sub SendEmail(strServer As String, _
strPort As String, _
strSendUsing As String, _
strUsername As String, _
strPwd As String, _
strSubject As String)

Dim NewMail As CDO.Message

Set NewMail = New CDO.Message

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True


NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1


NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strServer

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = strPort '465

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = strSendUsing '2

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = strUsername

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strPwd

NewMail.Configuration.Fields.Update

With NewMail
.Subject = "Test Mail from LearnExcelMacro.com" & strSubject
.From = strUsername
.To = "exam@xyz.co.kr"
.CC = ""
.BCC = ""
.BodyPart.Charset = "utf-8"
.TextBody = "Body"
End With

NewMail.Send
MsgBox ("Mail has been Sent")

Set NewMail = Nothing

End Sub


Thanks in advance,
thenndral

Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>