send email using asp.net

Discussion in 'ASP.NET / ASP.NET Core' started by vincentphuah, Aug 3, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I am new to asp.net and I just found out a very good tutorial on sending email through asp.net.
    However I have a qucik question.

    SmtpMail.SmtpServer = "mail.yourserver.com" -> in my case, it should be webmail.vincephuah.com?

    Please advice.
    Thanks!


    *************************************************
    Imports System.Web.Mail
    'namespace to be imported

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
    System.EventArgs) Handles Button1.Click
    Dim mailMessage As New MailMessage()
    'creating an instance of the MailMessage class
    mailMessage.From = "[email protected]"
    'senders email address
    mailMessage.To = "[email protected]"
    'recipient's email address
    mailMessage.Cc = "[email protected]"
    'email address of the Cc recipient
    mailMessage.Bcc = "[email protected]"
    'email address of the Bcc recipient
    mailMessage.Subject = "Hello"
    'subject of the email message
    mailMessage.BodyFormat = MailFormat.Text
    'message text format. Can be text or html
    mailMessage.Body = "This tutorial is sending email with an ASP.NET app."
    'message body
    mailMessage.Priority = MailPriority.Normal
    'email priority. Can be low, normal or high
    SmtpMail.SmtpServer = "mail.yourserver.com"
    'mail server used to send this email. modify this line based on your mail server
    SmtpMail.Send(mailMessage)
    'using the static method "Send" of the SmtpMail class to send the mail
    Response.Write("Mail sent")
    'message stating the mail is sent
    End Sub
     
  2. Takeshi Eto

    Takeshi Eto DiscountASP.NET Staff

    Use: localhost
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page