Hi all,how r u?
i am trying to send email from my priject, i write the following code

Dim myMail As New MailMessage()
myMail.From = "from@microsoft.com"
myMail.To = "to@microsoft.com"
myMail.Subject = "UtilMailMessage001"
myMail.Priority = MailPriority.Low
myMail.BodyFormat = MailFormat.Html
myMail.Body = "<html><body>UtilMailMessage001 - success</body></html>"
' Dim myAttachment As New MailAttachment("c:\attach1.txt", MailEncoding.Base64)
' myMail.Attachments.Add(myAttachment)
SmtpMail.SmtpServer = "MyMailServer"
SmtpMail.Send(myMail)

but in run time its not working and tells me
"the transport faild to connect to the server"
can any one tell me what to do??


thanks

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

Have you got the server name correct? (btw I've not tested that so I'm not saying the above code is necessarily correct)

Does the SMTP server actually exist?

ya, i checked the STMP server .

Does that server allows relaying or have you used some authentication method?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.