ASP.NET Email application

SMTP stands for Simple Mail Transfer Protocol . The System.Net.Mail namespace contains classes used to send e-mail to a SMTP server for delivery. The default port using SMTP is 25 , but it may vary different Mail Servers.


The two classes here we are using for sending email are MailMessage Class and SmtpClient Class. The MailMessage class represents the content of a mail message. The SmtpClient class transmits email to the SMTP host that you designate for mail delivery.

The following ASP.NET source code shows how to send an email from a Gmail address using SMTP server. The Gmail SMTP server name is and the port using send mail is 587 and also using NetworkCredential for password based authentication.



The above code you have to replace username and password with you gmail user name and password. Also you have to provide the from address as your gmail address.



The following ASP.NET program using a gmail address as from address and server as gmail smtp server for sending a SMTP email message.


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.vb (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About