.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Email >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Send an Email in ASP Dot Net using SmtpMail

Posted By:Prasanti Prusty       Posted Date: January 25, 2010    Points: 10    Category: Email    URL: http://www.dotnetspark.com  

This code snippets is used to Send an Email in ASP.Net using SmtpMail in asp.net using vb.net
 

Sometimes we need to send mail to the user to notify something.. this code sample will help you to do that

Imports System.Drawing

Partial Class Default3
    Inherits System.Web.UI.Page

    Protected Sub btnSendMail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMail.Click
        'Send an Email in ASP Dot Net using SmtpMail
        Try
            Dim EmailTo As String = "Sample@sss.com"
            Dim EmailFrom As String = "ddddd@sss.com"
            Dim EmailSubject As String = "Sample Email"
            Dim EmailBody As String = "Test email"
            System.Web.Mail.SmtpMail.Send(EmailFrom, EmailTo, EmailSubject, EmailBody)
            Response.Write("Mail sent Successfully.")
        Catch ex As Exception
            Response.Write("Mail Process Failure.")
        End Try

    End Sub
End Class

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend