login about faq

Hi,

I can't seem to find a method that can get multipart properties from an email ("To & Return-Path")

namespace ConsoleApplication1 { class Program {

    static void Main(string[] args) {

        string filepath = Path.GetDirectoryName("/Users/Documents/feedback/feedback.yahoo/4E/");
        DirectoryInfo d = new DirectoryInfo(filepath);

        foreach (var file in d.GetFiles("*.eml"))
        {

            var o = file.FullName;
            Console.WriteLine("FILE: " + o);

            // Place file path as variable in loop

            Chilkat.Email email = new Chilkat.Email();

            //  First, load an email from a file.
            //  Note: an email object may be loaded from a file, or
            //  downloaded directly from a POP3 or IMAP server...
            bool success;
            success = email.LoadEml(o);
            if (success != true)
            {
                Console.WriteLine(email.LastErrorText);
                return;
            }

            //  How many header fields?
            int n;
            n = email.NumHeaderFields;
            if (n > 0)
            {

                //  Display the name and value of each header:
                int i;
                string subscriber;
                string client;
                string cleanclient;
                string alternative;
                bool isMultipart;
                string toAdd;

                for (i = 0; i <= 1 - 1; i++)
                {
                    isMultipart = email.IsMultipartReport();
                    client = email.GetDeliveryStatusInfo("Original-Mail-From"); //YAHOO
                    subscriber = email.GetDeliveryStatusInfo("Original-Rcpt-To");
                    toAdd = email.GetToAddr(i);
                    alternative = email.GetReport(i);

                    if (client == null)
                    {
                        isMultipart = email.IsMultipartReport();
                        client = email.GetAltHeaderField(i, "Subject");        //AOL
                        subscriber = email.EmailDateStr;
                        Console.WriteLine("Multipart?: " + isMultipart);
                        Console.WriteLine("Subscriber: " + subscriber);
                        Console.WriteLine("-----------------------------------");

                    }
                    else
                    {

                        //remove angle brackets
                        cleanclient = Regex.Replace(client, @"[<$>]", "");

                        //remove rest of email address after @
                        int x = cleanclient.IndexOf("@");
                        if (x > 0)
                            cleanclient = cleanclient.Substring(0, x);

                        Console.WriteLine("Multipart?: " + isMultipart);
                        Console.WriteLine("Client: " + cleanclient);
                        Console.WriteLine("Subscriber: " + subscriber);
                        Console.WriteLine("-----------------------------------");
                    }
                }
            }
        }
    }

        }

    }
This question is marked "community wiki".

asked May 23 at 04:31

conormclav's gravatar image

conormclav
1

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×184
×98
×14
×6

Asked: May 23 at 04:31

Seen: 960 times

Last updated: May 23 at 04:31

powered by OSQA