Mail.dll - .NET email component (IMAP, POP3)

IMAP component and POP3 component that allows you to receive e-mails and process e-mail messages in .NET applications. Includes SMTP component for sending, along with e-mail signing, encrypting and signature verification. Written entirely in managed code. Works with .NET 2.0, 3.0, 3.5, 4.0 and 4.5 including Mono. Dedicated Mail For Windows Store version is also available.

Features

What folks are saying about Mail.dll

Quick start samples

  • Receive e-mails from IMAP server using C#
    	                using(Imap imap = new Imap())
                        {
                            imap.Connect("imap.server.com");  // or ConnectSSL for SSL
                            imap.UseBestLogin("user", "password");
    
                            imap.SelectInbox();
                            List<long> uids = imap.Search(Flag.Unseen);
                            foreach (long uid in uids)
                            {
                                IMail email = new MailBuilder()
                                    .CreateFromEml(imap.GetMessageByUID(uid));
                                Console.WriteLine(email.Subject);
                            }
                            imap.Close();
                        }
                    
  • Receive e-mails from POP3 server using C#
                        using(Pop3 pop3 = new Pop3())
                        {
                            pop3.Connect("pop3.server.com");  // or ConnectSSL for SSL       
                            pop3.UseBestLogin("user", "password");
    
                            List<string> uids = pop3.GetAll();
                            foreach (string uid in uids)
                            {
                                IMail email = new MailBuilder()
                                    .CreateFromEml(pop3.GetMessageByUID(uid));
                                Console.WriteLine(email.Subject);
                            }
                            pop3.Close();
                        }	            
                    
  • Send e-mail using SMTP server using C#
                        IMail email = Mail
                            .Html(@"Html with an image: <img src=""cid:lena"" />")
                            .AddVisual(@"c:\lena.jpeg").SetContentId("lena")
                            .AddAttachment(@"c:\tmp.doc").SetFileName("document.doc")
                            .To("to@example.com")
                            .From("from@example.com")
                            .Subject("Subject")
                            .Create();
    
                        using(Smtp smtp = new Smtp())
                        {
                            smtp.Connect("smtp.server.com");  // or ConnectSSL for SSL
                            smtp.UseBestLogin("user", "password");
    
                            smtp.SendMessage(email);                      
    
                            smtp.Close();    
                        }	            
                    
  • Receive e-mails from IMAP server using VB.NET
                        Using imap As New Imap
                            imap.Connect("imap.server.com")  ' or ConnectSSL for SSL
                            imap.UseBestLogin("user", "password")
    
                            imap.SelectInbox()
                            Dim uidList As List(Of Long) = imap.Search(Flag.Unseen)
    
                            For Each uid As Long In uidList
                                Dim email As IMail = New MailBuilder() _
                                    .CreateFromEml(imap.GetMessageByUID(uid))
                                Console.WriteLine(email.Subject)
                            Next
                            imap.Close()
                        End Using	            
                    
  • Receive e-mails from POP3 server using VB.NET
                        Using pop3 As New Pop3
                            pop3.Connect("pop3.server.com")  ' or ConnectSSL for SSL       
                            pop3.UseBestLogin("user", "password")
    
                            For Each uid As String In pop3.GetAll()
                                Dim email As IMail = New MailBuilder() _
                                    .CreateFromEml(pop3.GetMessageByUID(uid))
                                Console.WriteLine(email.Subject)
                            Next
                            pop3.Close()
                        End Using
                    
  • Send e-mail using SMTP server using VB.NET
                        Dim email As IMail = Mail _
                            .Html("Html with an image: <img src=""cid:lena"" />") _
                            .AddVisual("C:\lena.jpeg").SetContentId("lena") _
                            .AddAttachment("C:\tmp.doc").SetFileName("document.doc") _
                            .To("to@example.com") _
                            .From("from@example.com") _
                            .Subject("Subject") _
                            .Create()
    
                        Using smtp As Smtp = New Smtp
                            smtp.Connect("smtp.server.com")  ' or ConnectSSL for SSL
                            smtp.UseBestLogin("user", "password")
    
                            smtp.SendMessage(email)
    
                            smtp.Close()
                        End Using	            
                    

Our customers

Get Started Today

Download Now