Results 1 to 2 of 2

Thread: Send email from ASP.NET

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Send email from ASP.NET

    Dear All,

    How to send email from ASP.NET? .. please advise .. thanks a lot in advance

    Regards
    Winanjaya

  2. #2
    Member
    Join Date
    Sep 2004
    Posts
    45
    Real basic sample here.

    VB Code:
    1. Sub btnSend_Click(s as Object, e as EventArgs)
    2.  
    3.     Dim newMail as New MailMessage
    4.    
    5.     newMail.From = txtFrom.Text
    6.     newMail.To = txtTo.Text
    7.     newMail.Subject = txtSubject>text
    8.     newMail.BodyFormat = MailFormat.Html
    9.     newMail.Body = txtMessageContent.Text
    10.     SmtpMail.SmtpServer = "ServerNameHere"
    11.     SmtpMail.Send(newMail)
    12.  
    13. End Sub

    Don't forget to put your
    VB Code:
    1. <%@ import Namespace="System.Web.Mail" %>
    at the top of the page. That is assuming you are doing your code inline. If not, just do your import on the code behind page as you would for a windows form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width