i have a homework of programming (vb.net) that need create send email function by using vb.net.. I already find a bunch of solution in google, but still i didn't work..
below is my source code..
Imports System.net.Mail Public Class Form1 Sub SendOneEmail() Dim SendTo, strSubject, strMessage As String Try SendTo = "email@example.com" strSubject = "Yeah" strMessage = "Yeah" SendEmail(strMessage, SendTo, strSubject) Catch ex As Exception MessageBox.Show(ex.Message & "in SendOneEmail") End Try End Sub Public Sub SendEMail(ByVal Message As String, ByVal EMailAddress As String, ByVal Subject As String) Dim EMail As New System.Net.Mail.MailMessage Dim SMTPServer As New System.Net.Mail.SmtpClient Dim Authentication As New Net.NetworkCredential("firstname.lastname@example.org", "password") EMail.To.Add(EMailAddress) EMail.From = New System.Net.Mail.MailAddress("email@example.com") EMail.Body = Message EMail.Subject = Subject SMTPServer.Timeout = 100000 SMTPServer.Host = "smtp.gmail.com" SMTPServer.Port = 25 SMTPServer.Credentials = Authentication SMTPServer.Send(EMail) End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SendOneEmail() End Sub End Class
actually i already find a bunch of solution and source code.. i dunno where is the problem.. another friend of mine said perhaps i have a problem with my internet connection... (i don't think so)
And i search in google.. there is the URL that said i need to change the setting of POP/IMAP in my gmail account..
And i also don't know what port that i should use XD
can you figure out what's the problem??
Thank you ~~~:confused: ORZ