Common Features
Asynchronous operations
ActiveUp.MailSystem reduces your application’s workload by permitting it to make asynchronous client calls. This eliminates your need to program in multi-threading routines and all of the headaches that come with it. You simply assign a call back method and launch the process. Then you can launch other tasks without having to create wait loops that poll for results.
Show C# code
/// <summary> /// Send a test email /// </summary> public void SendTestEmail() { // We create the message object Message message = new Message();
// We assign the sender email message.From.Email = "user1@example.com";
// We assign the recipient email message.To.Add("user2@example.com");
// We assign the subject message.Subject = "This is the subject";
// We assign the body text message.BodyText.Text = "This is the body";
// Send the message specifying the address of the smtp server, asynchronously. // SendingDone method gets the notification once the message sending is done. message.BeginSend("smtp.example.com", new AsyncCallback(this.SendingDone)); }
/// <summary> /// Call on BeginSend /// </summary> /// <param name="ar"></param> private void SendingDone(IAsyncResult ar) { Console.WriteLn("Message sent successfully."); }
Secure connections using SSL
All clients support secure connections using SSL. It is as easy as using the ConnectSsl() method instead of the standard Connect() method. Everything is handled by the ActiveUp.MailSystem automatically for you. You just drop the component onto your form and set a few properties.
You’re probably aware that whenever a mailbox connection is made using the standard POP3 Connect() method, the username and password are transmitted across the Internet clear and unencrypted. This means that anyone who cares to eavesdrop on your mail connections can acquire user names and passwords. This means that they can also retrieve and read e-mail and send e-mail through your server while making it look like that e-mail actually came from an authorized user. It’s a great way to end up on spam lists or to wind up in legal conflicts because of an offensive e-mail that never actually came from your domain.
The quickest and easiest way to prevent any of this from happening is to use our ConnectSsl method to connect to the mail server using a Secure Socket Layer (SSL) connection. Once that connection is made through a server that is protected with a digital security certificate, all server connections are fully encrypted and safe from prying eyes. There is no more safer and secure way to handle your organization’s e-mail messaging.
Show C# code
// We instantiate the pop3 client. Pop3Client pop = new Pop3Client();
// Connect to the pop3 client pop.ConnectSsl("mail.example.com", "user@example.com", "userpassword");
Show VB.NET code
' We instantiate the pop3 client. Dim pop As Pop3Client = new Pop3Client();
' Connect to the pop3 client pop.ConnectSsl("mail.example.com", "user@example.com", "userpassword")
Mail signing & encryption/decryption using S/MIME & OpenPGP
When email was first introduced it was a simple protocol designed to effect communication between universities and government agencies that used AARPANet. No one could have possibly envisioned email becoming a communication method that would threaten the very existence of the world’s postal services.
Now nearly every business and organization in the world uses e-mail to communicate with customers and employees. Highly sensitive information is regularly communicated via e-mail these days and the threat of that information being intercepted by unauthorized persons continues to grow. The fastest and easiest way to secure e-mail communications is by using encryption technology based on S/MIME and OpenPGP methodologies. Creating e-mail that can only be opened and read by authorized recipients is as easy as dropping our mail signing and encryption/decryption control onto your form and setting a few properties.
Show C# code
// We create the message object Message message = new Message();
// We assign the sender email message.From.Email = "user1@example.com";
// We assign the recipient email message.To.Add("user2@example.com");
// We assign the subject message.Subject = "This is the subject";
// We assign the body text message.BodyText.Text = "This is the body";
// Encrypt the message. You need the recipient(s) certificate(s) (with public key only). X509Certificate2 recipientCertificate = new X509Certificate2("c:\\Cert.cer");
CmsRecipient recipient = new CmsRecipient(recipientCertificate);
message.Send("mail.example.com");
Another security issue facing users is the uncertainty surrounding whether or not a mail sender really is who he or she days they are. Mail spoofing is as easy as specifying any name you want in your mail client configuration. Even specifying an e-mail address that you do not own is entirely possible and spammers do it all the time. Just look in your own spam quarantine folder. The chances are it is full of spoofed e-mails and some of that e-mail may actually have your own name and e-mail address as the sender.
The solution is to enable your senders to digitally sign their e-mail using a secure certificate. This way the recipient will have the opportunity to verify the sender and to certify that the content of the e-mail hasn't been modified between the sender side and your side like often happens when mail is intercepted as it passes through a gateway or by other shady means.
Show C# code
// We create the message object Message message = new Message();
// We assign the sender email message.From.Email = "user1@example.com";
// We assign the recipient email message.To.Add("user2@example.com");
// We assign the subject message.Subject = "This is the subject";
// We assign the body text message.BodyText.Text = "This is the body";
// Here we only want the signer's certificate to be sent along. Not the whole chain. CmsSigner signer = new CmsSigner(new X509Certificate2("c:\\cert.key")); signer.IncludeOption = X509IncludeOption.EndCertOnly;
message.SmimeAttachSignatureBy(signer);
message.Send("mail.example.com");
Separate object for the message and the clients
As the mail object is shared between clients they act like controller in the delivery or mail receiving process. This architecture allows you to build your software on a single method. The following code demonstrates how to receive emails using POP3 then just as easily automatically forward them using SMTP:
Show C# code
// We instantiate the pop3 client. Pop3Client pop = new Pop3Client();
// Connect to the pop3 client pop.Connect("mail.example.com", "user1@example.com", "userpassword");
Message message = pop.RetrieveMessageObject(1);
// We modify the subject to notify this is a foward message.Subject = "FW: " + message.Subject;
// We assign the sender email (in this case the initial receiver) message.From.Email = "user1@example.com";
// We reassign the recipient message.To.Clear(); message.To.Add("user2@example.com");
// We forward the mail message.Send("mail.example.com");
Fully Accessible Headers
Every part of the e-mail can be controlled, accessed, parsed and modified by you including the headers. It is also possible to easily add custom headers for your own special purposes. These custom headers can be used for any reason including creating automation processes that are only triggered when certain header data is detected. You can also create white listing and blacklisting routines that parse headers looking for bulk mail indicators or use it to identify mail where the recipient’s name is not in the “To”, “CC” or “BCC” list.
Show C# code
// We add an header named "X-CustomDemo" with the value "Send by demo" // It will be visible to any client supporting header retrieval message.HeaderFields.Add("X-CustomDemo", "Sent by demo");
// We retrieve the header named "X-CustomDemo" string headerValue = message.HeaderFields["X-CustomDemo"];
Mail encoding customization for globalization
E-mail is the common denominator that unites people from around the world regardless of the language they speak. If you want your organization to be truly global in reach, it is important that you are able to respond to e-mail inquiries from others countries that do not use the same charset that you use. There will also be times that you will want to send your Japanese or Chinese customers messages in their native language. We have got you covered. The ActiveUp.MailSystem lest you do this easily by specifying the charset you want for every part of the message. It is also possible to encode both the subject and e-mail addresses for even greater flexibility:
Show C# code
// We encode the specified subject with iso-8859-1 character set message.Subject = Codec.RFC2047Encode("Here are some non-ASCII character çùö.", "iso-8859-1");
Manage and inspect bounced e-mail messages and perform e-mail address parsing
Whenever a returned mail notification is received from a POP3 or IMAP4 server you will have the ability to parse and analyze the return code. Mail returned for any of the common temporary conditions, such as box full, or server temporarily unavailable, can be queued and re-sent at a later date. Non-existent addresses can be identified and processes can be written to automatically clean up your mailing list. You can also identify mail that has been blocked by spam filters and take the appropriate action. All of this serves to improve your list’s deliverability statistics and to cut down on email processing time by removing dead email addresses.
Show C# code
// We instantiate the pop3 client. Pop3Client pop = new Pop3Client();
// We connect to the pop3 client pop.Connect("mail.example.com", "user1@example.com", "userpassword");
// We retrieve a message at a specific index (index 1 in this sample) Message message = pop.RetrieveMessageObject(1);
// If you need extended features, you can GetBounceStatus() method BounceResult bounceResult = message.GetBounceStatus();
// 3 is a high probability if (bounceResult.Level == 3) { Console.WriteLine("Message sent to {0} is bounced", bounceResult.Email); } else { Console.WriteLine("Message sent to {0} is not bounced", bounceResult.Email); }
Send from / receive Message object to file and streams
E-mail archiving or even directing e-mail messages to automation processes is a snap when you use the ActiveUp.MailSystem. You can quickly and easily write message to disk files or store the entire RFC822 e-mail to your database or any other file system that you choose. You can also do post processing including loading the messages back into the e-mail system and parsing them using the included Parser class.
Show C# code
// We instantiate the pop3 client. Pop3Client pop = new Pop3Client();
// Connect to the pop3 client pop.Connect("mail.example.com", "user1@example.com", "userpassword");
Message message = pop.RetrieveMessageObject(1);
// We create a message filename string messageFilename = message.MessageId + ".eml";
// We store the message to the disk (RFC822 format) message.StoreToFile(messageFilename);
// Now we reset the message object message = new Message();
// We load the message from the disk Parser.ParseMessageFromFile(messageFilename);
// We modify the subject to notify this is a forward message.Subject = "FW: " + message.Subject;
// We assign the sender e-mail (in this case the initial receiver) message.From.Email = "user1@example.com";
// We reassign the recipient message.To.Clear(); message.To.Add("user2@example.com");
// We forward the mail message.Send("mail.example.com");
|