Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i am using webmail. i need to use this for sending mail from the VB.net windows application. Currently, Gmail is not allowed to use in certain countries.
I am trying to use smtp.webmail.com.But error "Failure Sending mail" is coming


Please help to solve
I really appreciate any help you can provide.


regards
Nirmala

What I have tried:

<pre>Using mm As New MailMessage("info@ntrading.com", "aaa@gmail.com")
                filePath = Application.StartupPath + "\\PaySlip\\" + PaySlipName + ".pdf"
                mm.Subject = "test"
                mm.Body = "Checking"
                mm.Attachments.Add(New Attachment(filePath))
                'For Each filePath As String In openFileDialog1.FileNames
                '    If File.Exists(filePath) Then
                '        Dim fileName As String = Path.GetFileName(filePath)
                '        mm.Attachments.Add(New Attachment(filePath))
                '    End If
                'Next
                mm.IsBodyHtml = False
                Dim smtp As New SmtpClient()
                smtp.Host = "secure.webmail.com"
                smtp.EnableSsl = True
                Dim NetworkCred As New NetworkCredential("info@ntrading.com", "xxxxx123")
                smtp.UseDefaultCredentials = True
                smtp.Credentials = NetworkCred
                smtp.Port = 25

                smtp.Send(mm)
                MessageBox.Show("Email sent.", "Message")
            End Using
Posted
Updated 2-Dec-22 2:34am

1 solution

The host name will be whatever is required by the mail host you are using. If you can't find it, then contact their support department for help.

NB: You will need an account with whatever service you are using. You can't simply throw email at a random server and expect that server to send it for you. If you could, then every spammer in the world would abuse it, and that server would be blocked as an "open relay by every other server in the world.
 
Share this answer
 
Comments
Nirmala Saravanan 2-Dec-22 8:36am    
we have webmail account . Thats why I asked for especially webmail smtp host
Richard Deeming 2-Dec-22 8:39am    
Assuming "webmail" is an email provider, and you're not just using a generic term for web-based email, then you'll need to contact the "webmail" support department for help.

NB: Your code shows you're sending a message from a GMail address. If that actually works via a non-GMail server, then that server is an open relay, and will be blocked by most recipients.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900