Hey;
I'm so sorry because I don't know VB but I use this code for sending email for c#. I hope you can understand and use it for yourself:
string from = "*********@gmail.com"; //Replace this with your own correct Gmail Address
string to = useremail.Text; //Replace this with the Email Address to whom you want to send the mail
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "Your Topic Message", System.Text.Encoding.UTF8);
mail.Subject = "Write the subject of your email";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
string strBody = "<p>YOU </p>" +
"<p>CAN</p>" +
"<p>WRITE WHATEVER</p>" +
"<p>YOU WANT AS A BODY OF YOUR MESSAGE</p>" +
"<p>Thank you!</p>" +
"<p>Best Regards</p>";
mail.Body = strBody; //Put your mail body to strBody to show it in your email...
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High; //Your Email will have a priority so it will have red "!"
SmtpClient client = new SmtpClient();
//Add the Creddentials- use your own email id and password
client.Credentials = new System.Net.NetworkCredential(from, "YOUR EMAIL'S PASSWORD");
client.Port = 587; // Gmail works on this port
client.Host = "smtp.gmail.com";
client.EnableSsl = true; //Gmail works on Server Secured Layer
try
{
client.Send(mail);
}
catch (Exception ex)
{
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
{
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;
}
HttpContext.Current.Response.Write(errorMessage);
} // end try
Hope, it works for you as well... If there is a problem and doesn't work, just let me know because may be I copied that code wrong from my application.
Baran Bozoglu