How to send mail for org domain using web mail service in asp net


ASP.NET is a popular programming used for developing web . One requirement in web applications is the ability to send emails. In this article, we will explore how to send mail for an org using a web mail in ASP.NET.

Step 1: Setting up SMTP Configuration

The first step is to the SMTP in your ASP.NET application. SMTP (Simple Mail Transfer Protocol) is the standard protocol used for sending emails. To configure the SMTP settings, you need to add the following code to your web.config file:


In the above code, replace “” with the SMTP server address for your org domain. Set the port number to the appropriate value (usually 587 for secure connections). Replace “” and “your-password” with your email address and password, respectively.

Step 2: Sending Email

Once the SMTP configuration is set up, you can use the SmtpClient class in ASP.NET to send emails. Here's an example:

using System;
using System.Net.Mail;

public class EmailSender
    public void SendEmail(string recipient, string subject, string body)
        using (SmtpClient smtpClient = new SmtpClient())
            MailMessage mailMessage = new MailMessage();
            mailMessage.From = new MailAddress("");
            mailMessage.Subject = subject;
            mailMessage.Body = body;


In the above code, replace “” with your email address. The SendEmail method takes parameters: the recipient's email address, the subject of the email, and the body of the email. You can call this method to send emails from your ASP.NET application.


Sending emails for an org domain using a web mail service in ASP.NET is a straightforward . By the SMTP settings and using the SmtpClient class, you can easily send emails from your ASP.NET application. Remember to replace the placeholder values with your actual email address and SMTP server details.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents