SMTP Component for .NET Recommendation

I’ve been relying on the MailBee.NET SMTP Component from AfterLogic for several months now and just wanted to recommend it to anyone needing a SMTP component for your .NET development. It’s inexpensive and easy to use:

Pop3 pop = new Pop3();
try
{
    pop.Connect(emailPop3Server, 110);
    if (_quitting) { return; }

    pop.Login(emailAccountName, emailPassword, AuthenticationMethods.Auto);
    if (_quitting) { return; }

    MailMessageCollection msgs = pop.DownloadEntireMessages();
    foreach (MailMessage m in msgs)
    {
        try
        {
            if (m.HasAttachments)
            {
                foreach (Attachment attach in m.Attachments)
                {
                    if (attach.ContentType == "image/jpeg")
                    {
                        using (MemoryStream memStream = new MemoryStream(attach.GetData()))
                        {
                            Image img = Image.FromStream(memStream);

                            if (_quitting) { return; }

                            using (MemoryStream compressedJPG = BuildJPGWithCompressionSetting(img, 60))
                            {
                                // the filename doesn't need to be meaningful, and would be better if it weren't to prevent conflicts!
                                string newFileName = string.Format("{0}.jpg", Guid.NewGuid());
                                Upload(compressedJPG, ftpSite + newFileName, ftpAccountName, ftpPassword);
                            }
                        }
                    }
                    if (attach.ContentType == "multipart/related")
                    {
                        //MimePart mp = attach.AsMimePart;
                        //MimePartCollection mpc = mp.GetAllParts();
                    }
                } // thru each attachment
            } // has attachement?
        }
        finally
        {
            m.Dispose();
        }
    }   // loop thru all the messages
}
finally
{
    if (pop != null)
    {
        pop.DeleteMessages();
        pop.Disconnect();
        pop = null;
    }
}

The above code is used in a Windows Service I’ve written to automatically connect to a specific e-mail address, download the messages, and automatically upload the attached images to an FTP Server (I’ve removed some of the security checks that my code does).

You can see though in the code how easy it is to use the component. It takes the pain out of doing SMTP development and handles a wide variety of cases that might exist (there are multiple techniques for attaching images for example).

I purchased the Single Developer License at $69 — which is a license for unlimited use of the component by me.

They also have a set of components for IMAP, POP3 and security available individually or as a package deal (although it wasn’t clear the package was necessarily as good a price).

AfterLogic has a 30 day trial available for all of their components.

Recommended.