I am trying to create a small web based mail client and I am using openpop to connect to the mail server, to download all new emails at the server. But I can't get the email of the receiver of the mail(my emailaddress). The mail I am connecting to is a "catch-all" account. So there are many different email addresses used when emailing me. (500 of them)
I've tried using this:
OpenPop.Mime.Message newMessage;
....
newMessage = client.GetMessage(i);
....
string mailA = newMessage.Headers.To.ToString();
But the output is:
System.Collections.Generic.List`1[OpenPop.Mime.Header.RfcMailAddress]
I guess that the problem is that I am trying to convert an object to a string.
Can someone help me?
Thanks!
string mailto = "";
foreach (RfcMailAddress mailId in loadedMessage.Headers.To)
{
mailto += mailId.MailAddress.ToString() + "; ";
}
This should give mail addresses in a string with a ; as delimiter.