Click here to Skip to main content
16,016,076 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need to create a small report to be send automaticliy from VB.NET Windows application. I have wrote below code which is working on my private PC, and with Gmail settings, such as username + password + smtp.gmail.com, etc...

But with, my work informations, like my proxy ID + proxy password + company smptserver + port 25, does not working .

Do I missing some lines in my code:
VB
Imports System.Net.Mail
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Mail As New MailMessage
        Mail.Subject = "test email"
        Mail.To.Add("emailaddress")
        Mail.From = New MailAddress("emailaddress")
        Mail.Body = TextBox1.Text
        Dim SMTP As New SmtpClient("smtpserver")
        SMTP.EnableSsl = True
        SMTP.Credentials = New System.Net.NetworkCredential("username", "password")
        SMTP.Port = 25
        SMTP.Send(Mail)
    End Sub



Thank you in advance for help.
Posted

Google does not use port 25 for its email:
see here[^]
 
Share this answer
 
Well, we are using MS Exchange server, and me as client using Outlook. And, port is 25.
 
Share this answer
 
Found as solution. SSL line is no need ti.

SMTP.EnableSsl = True
 
Share this answer
 

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