Reply To Existing Email with new body content using Pop3 protocol

May 5, 2014 at 11:06 AM
Edited May 5, 2014 at 11:13 AM
Hi All,

How can i reply to an existing email with new body in its content ? well just for your information I am using Pop3 protocol.

regards,
Coordinator
May 5, 2014 at 12:27 PM
Unfortunately, I have a holiday week in Japan.
So, I don't have a time to show you the sample code that meets your requirement.


I recommend that you get more information about pop3.
See this article it may help your work.
http://www.codeproject.com/Articles/404066/Understanding-the-insides-of-the-POP-mail-protoco

regards.
May 9, 2014 at 4:22 PM
Hi Higty thanks for your reply... I check your post on codeproject and found the section which i am integrating in my post.

Forward Mail by SMTP

If you want to transfer your received mail, you can use CreateSmtpMessage method of MailMessage object.
Here is a sample code to do it
private static void Pop3MailReceiveUnRead()
{
    MailMessage mg = null;

    using (Pop3Client cl = new Pop3Client("pop.gmail.com"))
    {
        cl.Port = 995;
        cl.UserName = "xxxxx";
        cl.Password = "yyyyy";
        cl.Ssl = true;
        cl.AuthenticateMode = Pop3AuthenticateMode.Auto;
        var bl = cl.Authenticate();
        if (bl == true)
        {
            mg = cl.GetMessage(1);
            SmtpMessage smg = mg.CreateSmtpMessage();
            // you can send smg by SmtpClient object
        }
    }
}
Now above code is what i found from your code project post but currently i am not able to send the email cause i am getting SendMailResult as Authenticate and its getting failed no idea why is that getting occured ? Hope You will help me to solve that issue.

But I want to reply to an existing email the same way which we do in desktop version or mobile version of hotmail, yahoo etc but what property should i use to reply to an existing email. So my text will appended to an existing email.
Coordinator
May 9, 2014 at 4:45 PM
In my environment, I can not reproduct your issue that authenticate failure.
getting SendMailResult as Authenticate
It might be wrong username,password is set or port is not opened or other reason that you can't fail authenticate.
I hope to solve your issue.
Please show me your code to send e-mail.
If you post your code, I'll check it.

regards.
May 11, 2014 at 8:00 AM
Edited May 11, 2014 at 8:29 AM
Hi Higty I able to resolve the issue but still i am confused to reply an existing email. Let me explain what my requirement actually is...

Scenario : Adam Sends an email to Eve


From : Adam@blabla.com Subject : I Love you
Body : Hi, I am fine here in japan how r u ?
To : Eve@blabla.com Attachment: 2 Pdf file.


Now Eve will to an email so she will click on the reply button with the existing text @ the bottom which is by default when we hit the reply button.


From : Eve@blabla.com, Subject : Re: I Love you,
Body : I am fine also I Love u too -(Existing Email Text) Hi, I am fine here in japan how r u ?
To : Adam@blabla.com, Attachment: 2 Pdf file.


So I want to reply an existing email with no changes in existing body so how can i reply to an existing email ?
May 11, 2014 at 11:11 AM
Edited May 11, 2014 at 11:13 AM
Hi Rick!

How about just copy MailMessage, and do: BodyText = newText + some separator + BodyText ? And of course You would have to swap To with From
Marked as answer by rickjackson on 5/16/2014 at 12:41 AM
May 16, 2014 at 7:40 AM
Hi Jantar... Thanks for your reply... Actually by setting the subject : "RE : " + Existing Subject helped me to solve this issue. Thanks again