+1 vote

Good Day!

I am Nagendra from Accenture using mail.dll as part of our project.

Currently we have an requirement where we need to forward an email from the database which is already downloaded from pop3 (using mail.dll). Please help us with the C# sample code / steps to achieve this functionality. Thanks!


1 Answer

0 votes
Best answer


Please take a look at those 2 articles:

The code looks more or less like this:

IMail original = GetFirstMessage();

ForwardBuilder forwardBuilder = original.Forward();
forwardBuilder.Html = "Tom, <br/><br/>please resolve this.";

MailBuilder builder = forwardBuilder.Forward(
    new MailBox("bob@example.org", "Bob"));
    new MailBox("tom@example.org", "Tom"));

// You can add attachments to forwarded email

IMail forward = builder.Create();

using (Smtp smtp = new Smtp())
    smtp.Connect("smtp.example.org"); // or ConnectSSL
    smtp.UseBestLogin("user", "password");

static IMail GetFirstMessage()
    IMail email;
    using (Imap imap = new Imap())
        imap.Connect("imap.example.com"); // or ConnectSSL
        imap.UseBestLogin("user", "password");
        List<long> uids = imap.GetAll();
        if (uids.Count == 0)
            throw new Exception("There are no messages");
        var eml = imap.GetMessageByUID(uids[0]); 
        email = new MailBuilder().CreateFromEml(eml);
    return email;
by (298k points)