sending mail using visual studio 2008

donking13

New member
Joined
Dec 17, 2010
Messages
2
Programming Experience
Beginner
worked for me once, i copied the work from this youtube video YouTube - Visual basic 2008/2010 Tutorial - Email Sender using Smtp
but unfortunately for some reason it stopped working.

i was able to send message once using my mailing app that i made and received it on my gmail account.

whats getting in my nerves in that it shows no error or warning at all. so i really dont know what to do now.
im having thoughts that gmail dont allow this kind of activity anymore, i hope not.

this is the format from the video

VB.NET:
imports system.net.mail 

dim Mail as new mailmessage 
Try   
mail.From = New MailAddress("FROM EMAIL")   
mail.To.Add(TO EMAIL)   
mail.Subject = "SUBJECT"   
mail.Body = "BODY"   
Dim s As New SmtpClient("HOST")   
s.Port = PORT   
s.EnableSsl = True   
s.Credentials = New System.Net.NetworkCredential("FROM EMAIL, "FROM PASSWORD")   
s.Send(Mail)   
MsgBox("E-mail was sucsessfully sent!", MsgBoxStyle.Information, "Information")   
Catch ex As Exception 
End Try

this one is the filled up by me
VB.NET:
Try 
              Dim mail As New MailMessage 

              mail.From = New MailAddress(txtFrom.Text, "Thesis Testing") 
              mail.To.Add(txtTo.Text) 
              mail.Body = txtBody.Text 
              mail.Subject = txtSubject.Text 

              Dim s As New SmtpClient("smtp.live.com") 

              s.Port = 587 
              s.EnableSsl = True 
              s.Credentials = New System.Net.NetworkCredential("txtFrom.Text", "txtPassword.Text") 
              s.Send(mail) 
              MsgBox("E-mail was successfully sent!", MsgBoxStyle.Information, "Information") 
          Catch ex As Exception 
              MsgBox("there was an error, the program will close now!!!", vbCritical, "Fatal error") 
          End Try

my life's a little on the line :( someone to talk to regarding this would be very much appreciated.
 

donking13

New member
Joined
Dec 17, 2010
Messages
2
Programming Experience
Beginner
thank you sir, it worked with some changes

i used smtp.googlemail.com as the smtpclient
and change the port as 587

:)
 
Top Bottom