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
I always get a error message saying "The SMTP host was not specified" and it highlights "smtpServer.Send(mail)". What is the problem?
Tubman56 7 months ago
@Tubman56 Do you use a Hotmail, Gmail, Yahoo or AOL acc?
kukdeff 5 months ago
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.
kukdeff 7 months ago
@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
kukdeff 7 months ago