Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

.NET Mail Composer

4.94/5 (39 votes)
6 Aug 2008CPOL2 min read 2   5.2K  
Compose mail messages and send them through your mail account provider.

Introduction

This is a simple application developed using C# to send mail (with attachments) to multiple users. It uses an SMTP server to send mails.

Using the demo

To use the demo application, open "MailComposer.exe" from the demo link above. Type the subject and the body of the message. If the body of the message needs to be in HTML format, then select the checkbox provided below the body.

Image 1

After typing in the normal message body and the subject, click Other --> Add Attachments. The form shown below will be displayed:

Image 2

In the above window, click on the Add button to browse and add a new attachment. Add all the files to be attached, and then click the OK button to save the attachments. When you click the OK button, the attachments window will be closed and the previous form will be visible. Finally, to send the mail, you require a mail provider and a valid account to connect and send the mail. So, click Other --> Settings to open the form below to provide the settings.

Image 3

  1. In the above form, select the provider in which you have the account. If your provider cannot be found in the list, then select Other from the list, and type the mail server name and the port used to connect to the server.
  2. Then, enter your user ID (complete mail address of the provider) and the password used to connect to the server.
  3. (Optional) Enter the display name which will be shown in the recipient's display.
  4. (Optional) Enter the Reply To address to which the recipient has to reply.
  5. Type the recipient's address at the Add Recipient space provided, and click the Add button to add the recipient to the list. Add more recipient mail addresses, if required.
  6. Finally, if the server requires secured connection, then select the Use Secured Connection checkbox.
  7. Click the Save button to save the settings temporarily till the new message is sent. The form will be closed and the previous form will be activated.

Finally, click on the Send button to send the mail message.

Clarifications

In case of any questions, or suggestions to improve the project, feel free to contact me at "shridhar_tl@ymail.com".

History

No updates so far.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)