failure sending mail

Posted by Nithu under VB.NET on 7/23/2012 | Points: 10 | Views : 4431 | Status : [Member] | Replies : 1

i need to send the mail from my project in VB.Net

how to write the generic code for all domain

main problem is not able to send the mail from yahoo and other domains expect gmail

From gmail case it work
From yahoo or hotmail it not work

the sender domain is get from user so need the generic code for send to one domain another one

Error msg : failure sending mail

Public Function Mailing_Document()

Dim message As System.Net.Mail.MailMessage

' Dim smtp As New System.Net.Mail.SmtpClient("", 587)

Dim smtp As New System.Net.Mail.SmtpClient("", 465)

Dim attach As System.Net.Mail.Attachment

Dim sFrom As String, sTo As String, sSsub As String, sMsg As String

Dim sFile As String

' sFrom = ""

sFrom = ""

sTo = ""

sFile = "C:\Documents and Settings\Admin\Desktop\document.pdf"

sSsub = "PO_Invoice-Detail"

sMsg = "Ref the Attachment for detail of invoice"

message = New System.Net.Mail.MailMessage(sFrom, sTo, sSsub, sMsg)
message.Bcc.Add("") '
message.CC.Add("") '

If My.Computer.FileSystem.FileExists(sFile) Then

attach = New System.Net.Mail.Attachment(sFile)


End If

smtp.EnableSsl = True

smtp.Credentials = New System.Net.NetworkCredential(sFrom, "chhhe12")



MessageBox.Show("Well, the mail message appears to have been a success!", " Successful?", MessageBoxButtons.OK, MessageBoxIcon.Information)

Catch exc As Net.Mail.SmtpException
MessageBox.Show(exc.StatusCode.ToString, " Something Happened?", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Function


Posted by: Hemanthlaxmi on: 7/23/2012 [Member] Starter | Points: 25

Here are some examples of doing a basic html email messages.

If this helps you .
Please "Mark as Answer"

Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response