El TecnoBaúl de Kiquenet

Kiquenet boring stories

Smtp Mail utilizando Gmail

Posted by kiquenet en 5 abril 2010

Código fuente:

Imports System.Net.Mail

Imports System.Net.Mail.MailMessage

Imports System.Net.NetworkCredential


    Dim mail As New MailMessage()

    Dim msgBody As String

    Dim smtp As New SmtpClient

    mail.From = New MailAddress(ur-gmail-account@gmail.com, "display name")


    mail.Subject = Subject

    mail.Body = msgBody

    mail.IsBodyHtml = True ' This is to enable HTML in your email body

    mail.ReplyTo = New MailAddress(“reply-to-email-address“)  ' This is optional, it allows you to add Reply To email address.

   smtp.Host = "smtp.gmail.com"

   smtp.Port = 587; // 465; // 587

   smtp.EnableSsl = True

   smtp.Credentials = New System.Net.NetworkCredential(ur-gmail-account@gmail.com, "gmail-password")


   lblFlag.Text = "Your Message has beent sent."


Note: We can build this email form AJAX based, by putting the content in an UpdatePanel control, and add the button “send” as a trigger.

<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" userName="your_username" password="your_ password" port="465"/>


smtp.gmail.com (use authentication)

Use Authentication: Yes

Port for TLS/STARTTLS: 587

Port for SSL: 465

Referencia: http://geekswithblogs.net/aymanfm/archive/2006/03/09/71868.aspx


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: