65.9K
CodeProject is changing. Read more.
Home

EmailSender

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.69/5 (16 votes)

Feb 18, 2003

1 min read

viewsIcon

92092

downloadIcon

3423

A suite of classes to send email messages and attachments.

EMailSender - a png file

Address Book - a png file

Introduction

EmailSender is a simple application which allows you to send an email with a text body or an HTML body and if you want one attachment file. The control which displays the email body is only a RichText control. This project is a mix of two initial projects:

  1. EmailSender C# project without an address book.
  2. AddressBook C# project.

Important note: You need the MagicLibrary to build the menus and the TabControl.

Description

This project uses some useful namespaces:

  • System.Windows.Forms and MagicLibrary classes to build the user interface (controls, context menus, notify icon, ...).
  • System.IO to read and write XML files.
  • System.Xml to parse XML files.
  • System.Web.Mail to create and send the email.

Also, EmailSender uses two XML files:

1. EMailConfig.xml to configure the email address and the smtpserver . You must edit and configure this file before start the application.

        
 <?xml version="1.0" encoding="utf-8" ?>
 <providers>
   <name>
     Provider name // examples: CompuServe, American Online ...,
     do nothing but it's a better description
     <smtpserver>smtpserver // examples: smtp.providerName.com,
     mail.providerName.com or the ip address</smtpserver>
     <email>your email address for this provider</email>
  </name>
     // You can add an another provider
  <name>
     <smtpserver></smtpserver>
     <email></email>
  </name>
 </providers>
        

When you connect to the net, choose the right email for the current provider (smtpserver will be right). If you change the provider, you must also change the email. With this, you don't need authenticate (no username and no password) to connect to the SMTP server.

2. AddressBook.xml with only two contacts but you can add or remove friends and contacts.

 <?xml version="1.0" encoding="utf-8" ?> 
 <book>
   <friend>
      <name>name friend</name>
      <email>email friend</email>
   </friend>
   <contact>
      <description>Submit an article to CodeProject</description>
      <email>submit@codeproject.com</email>
   </contact>
   <friend>
      <name>t</name>
      <email></email>
   </friend>
   <contact>
      <description>Contact the CodeProject webmaster</description>
      <email>webmaster@codeproject.com</email>
   </contact>
 </book>
        

Check the item in the ListView for select or remove.

Important note: the files EmailConfig.xml and AdressBook.xml must reside in the application directory (bin/debug, bin/release for examples).

That's all folks and good luck with C# programming .