How to make an email sender in vb 2010 / 2008

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
5,782
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 30, 2010

Watch in HD!
The video does lag a bit.
Whit this program can you send e-mails whit Hotmail, Gmail, Yahoo and AOL accounts.
You have to login whit an real email address and password.

Code:

Imports System.Net.Mail

Public Class EmailForm
Dim emailaddress As String
Dim password As String
Dim port As Integer
Dim host As String
Private Sub EmailForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
emailaddress = LoginForm.EmailTextBox.Text
password = LoginForm.PasswordTextBox.Text
If emailaddress.ToLower.Contains("@hotmail") Or emailaddress.ToLower.Contains("@live") Or emailaddress.ToLower.Contains("@msn") Then
port = 587
host = "Smtp.live.com"
ElseIf emailaddress.ToLower.Contains("@gmail") Then
port = 587
host = "smtp.gmail.com"
ElseIf emailaddress.ToLower.Contains("@aol") Then
port = 587
host = "smtp.aol.co.uk"
ElseIf emailaddress.ToLower.Contains("@yahoo") Then
port = 465
host = "smtp.mail.yahoo.com"
End If
End Sub
Private Sub SendMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendMail.Click
Dim smtpServer As New SmtpClient
Dim mail As New MailMessage()
smtpServer.Credentials = New Net.NetworkCredential(emailaddress, password)
smtpServer.Port = port
smtpServer.Host = host
smtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress(emailaddress)
mail.To.Add(TextBox1.Text)
mail.Subject = TextBox2.Text
mail.Body = TextBox3.Text
smtpServer.Send(mail)
MsgBox("The mail is sendt!", MsgBoxStyle.Information)
End Sub
End Class

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (kukdeff)

  • I always get a error message saying "The SMTP host was not specified" and it highlights "smtpServer.Send(mail)". What is the problem?

  • @Tubman56 Do you use a Hotmail, Gmail, Yahoo or AOL acc?

  • shure find out why. Can u send me the error report? I can't help u if i don't know what the problem is.

  • @CycoNoob How long have u been using VB? If its more than 5 minutes,s hould u easy be able to see that it vould not work width "smtpServ.send ( Email )". If u use some time to read the code and try to understand it will u

see all

All Comments (17)

Sign In or Sign Up now to post a comment!
  • that'work's forme Thanxs.

  • has anyone been able to fix the problem with smtpServer.Send(mail)?

  • Laggy

  • Thanks I also created mini different

    watch?v=L3QBqncCgxI

  • i also error at smtpServer,send(Mail)

  • @kukdeff same but i use yahoo!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more