Aegis Implicit Mail is a free and open source library which is designed to provide fast and developer friendly API to send emails using SMTP ports.
Sadly, Microsoft.Net.Mail Ssl Mails does not support Implicit Ssl Mail and it is still used by many servers, including port 465 of Gmail here AIM comes to make a readable and fast alternative to send your smtp mails.
Binaries are available in the form of NuGet package
To get a local copy of the current code, clone it using git:
$ git clone https://github.com/nilnull/AIM.git
If you want to have a sample SMTP mailing, you can write your program exactly like the way you write using System.Net.Mail
private void SendEmail()
{
var mail = "[email protected]";
var host = "smtp.gmail.com";
var user = "yourUserName";
var pass = "yourPassword";
//Generate Message
var mymessage = new MimeMailMessage();
mymessage.From = new MimeMailAddress(mail);
mymessage.To.Add(mail);
mymessage.Subject = "test";
mymessage.Body = "body";
//Create Smtp Client
var mailer = new MimeMailer(host, 465);
mailer.User= user;
mailer.Password = pass;
mailer.SslType = SslMode.Ssl;
mailer.AuthenticationMode = AuthenticationType.Base64;
//Set a delegate function for call back
mailer.SendCompleted += compEvent;
mailer.SendMailAsync(mymessage);
}
//Call back function
private void compEvent(object sender, AsyncCompletedEventArgs e)
{
if (e.UserState!=null)
Console.Out.WriteLine(e.UserState.ToString());
Console.Out.WriteLine("is it canceled? " + e.Cancelled);
if (e.Error != null)
Console.Out.WriteLine("Error : " + e.Error.Message);
}
As you might be familiar with System.Net.Mail, we have four important objects in sending mails:
For each mail you need to generate mail message,
AIM uses the same architecture. We have normal (mime) Mails and smime Mails that can be in a plain sender or Ssl Sender in addition Ssl Sender can be implicit and explicit.
More information can be found at our wiki
Please check our archive here
AIM is delivered by NilNull from PKI.Tools with special thanks to those who help us :