09-16-2012, 05:38 AM
Vinwarez Wrote:I've searched on Google and found this code:got this error
[code2=vbnet]Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New Net.NetworkCredential("username@gmail.com", "password")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("YOURusername@gmail.com")
mail.To.Add("TOADDRESS")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail from GMAIL"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class[/code2]
If you read the code, it's pretty much self-explanatory. You need to replace some stuff with your e-mail, password etc.
Support me by take tour to BPForums http://bit.ly/YTBCS1
Get More Views on youtubehttp://addm.cc/?WIZ01V
Get More Views on youtubehttp://addm.cc/?WIZ01V