Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Photos | Blogs | Beginners | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
DevExpress UI Controls
Search :       Advanced Search »
Home » VB.NET » Application to send Mails using ASP.NET and VB.NET

Application to send Mails using ASP.NET and VB.NET

I have made a small application, which is used to send mails, in ASP.Net and using VB.NET as the coding language. I have provided the zip file comprising of mail.aspx , which will use the mail.vb file to do the server side functioning. This application also demonstrates how the presentation has been separated from the business logic.

Page Views : 21825
Downloads : 657
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
SendMailInVBNET.zip
 
 
Discover the top 5 tips for understanding .NET Interop
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Hi, I have made a small application, which is used to send mails, in ASP.Net and using VB.net as the coding language. I have provided the zip file comprising of mail.aspx, which will use the mail.vb file to do the server side functioning.

This application also demonstrates how the presentation has been separated from the business logic.

The code that I have written is not written in the usual <% %> tags but in two seperate files viz mail.aspx which has the presentation and mail.vb which has the functionality coded in it.

Source Code:

Private Sub sendmail()
'''the procedure reads the values from the text boxes on the form and
'''appropriate values of the mailobj are filled and the mail is sent
'''using the smtp mail send method
Dim mailobj As MailMessage
mailobj =
New MailMessage()
mailobj.From = trim(request.Form("txtfrom"))
mailobj.To = trim(request.Form("txtto"))
mailobj.Body = trim(request.Form("txtmailbody"))
mailobj.Subject = trim(request.Form("txtsubject"))
mailobj.BodyFormat = MailFormat.Html
smtpmail.Send(mailobj)
response.Write("<BR><font color=red face=verdana size=2> Sent the mails.</font>")
End Sub

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Vikram Joshi
Vikram has just finished his Masters in Computer Application(MCA), working currently as a developer for iSpan Technologies, Mumbai, India.Like others, he has found VB.NET a boon in disguise but hopes Microsoft will do something about the speed of execution, one of the attractions of good ol' VB6 :)
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Comments
abt smtpmail.smtpserver by ajay On January 26, 2006

hi friend,

                what is value of  smtpmail.smtpserver.plz reply

 Ajay  Thakur

Reply | Email | Modify 
Connection to another System transferring image with message by jeya On February 23, 2006

 ; ; ; ; ; ; ; ; ; ; ; ;

 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; I want to connect the (selected ip address) another  ;system.Then sending msg with image using vb.net (only using visual studion not c# coding). Pls reply immediately.i want very soon.

 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Thank u

Reply | Email | Modify 
Re: Connection to another System transferring image with message by senthil On August 31, 2007
protected void yourButton_Click(object sender, EventArgs e) { string strMailContent = "Welcome new user"; string fromAddress = "yourname@yoursite.com"; string toAddress = "newuser@hisdomain.com"; string contentId = "image1"; string path = Server.MapPath(@"images/Logo.jpg"); // my logo is placed in images folder MailMessage mailMessage = new MailMessage( fromAddress, toAddress ); mailMessage.Bcc.Add("inkrajesh@hotmail.com"); // put your id here mailMessage.Subject = "Welcome new User"; LinkedResource logo = new LinkedResource(path); logo.ContentId = "companylogo"; // done HTML formatting in the next line to display my logo AlternateView av1 = AlternateView.CreateAlternateViewFromString("
" + strMailContent, null, MediaTypeNames.Text.Html); av1.LinkedResources.Add(logo); mailMessage.AlternateViews.Add(av1); mailMessage.IsBodyHtml = true; SmtpClient mailSender = new SmtpClient("localhost"); //use this if you are in the development server mailSender.Send(mailMessage); } Note:SmtpClient mailSender = new SmtpClient(ConfigurationManager.AppSettings["MyCustomId"]); // use this in the Production Server. I have specified my email server in the web.config file
Reply | Email | Modify 
question by senthil On August 31, 2007
have added imports System.Net.Mail" to the top of the file where the event is implemented, but it seems that it doesn't recognize the namespace. I tried adding a reference to it (menu: WebSite->Add reference), but System.Net.Mail isn't listed in the Dialog box (under the .NET tab). Is it just my system, or isn't System.Net registered by default?how to add reference and i have added reference system.dll
Reply | Email | Modify 
answer by senthil On August 31, 2007
no replies
Reply | Email | Modify 
how can i send an email.. by kelvin On January 27, 2008
i am using web developer 2005.. for a aspx file.. how can i create a page that can send emails
Reply | Email | Modify 
Discover the top 5 tips for understanding .NET Interop
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.