Understanding the email sending procedure

In almost all software projects you work on you will need to send emails for one purpose or the other. If nothing else you will at least be adding a contact us section to your application from where people will be able to get in touch with you. All modern day programming languages have the ability to send emails. In this tutorial our goal is to explain the email sending process to you so that you understand the role of C# in the whole process.

C# does not send emails – SMTP does

The first concept you need to get clear about when learning how to send emails using C# is that it’s not the duty of C# to send emails. C# is only responsible for giving you all the classes required for creating the email message and handing it over to the SMTP server. Once you create your mail message using the classes given by C# the next responsibility of C# is to hand over your message to the SMTP server. Further it is the duty of the SMTP server to relay your email and deliver it to the final email destination. Look at the diagram below

Email sending using C#
 
From the diagram you can understand very well that at Step 1 you will be creating a mail message using C#, at Step 2 the message will be handed over to the SMTP server and at Step 3 the message will be delivered to the end user.

What is an SMTP server?

SMTP stands for Simple Mail Transfer Protocol. You can think of SMTP as a post box. This is where you go and post all your messages. When the SMTP server gets a new message it initiates the process of sending it to the end user. Just like a postman comes and takes the letters from a letterbox and delivers them at their final destination.

Do I need to install SMTP server on my computer?

The answer to this question is both yes and no. If you want to have your own SMTP server to send emails then you have to install it on your computer. But keep in mind that it’s not a simple process to setup your own SMTP server because most of the email companies like Google, Yahoo etc will not easily accept the emails sent from some unknown STMP server.

The best workaround for this is to use your Google, Yahoo or other email accounts to send emails. All you have to do is let C# know that it should go and hand over the message to these SMTP servers and rest will be taken care by them.

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp