0

i want to ask that how i can read gmail inbox using impax with MVC? i have searched the documentation but couldn't find any solution, i'm sharing my code i have done so far.

 public void getMessage()
        {
            var client = new ImapClient("imap.google.com", true, true);
            client.Port = 993;
            if (client.Connect())
            {
                if (client.Login("sabc@gmail.com", "12451susa"))
                {

                    // login successful
                }
            }
            else
            {
                ModelState.AddModelError("", "Connection Failed");
            }

        }

i want to fetch the emails in inbox and display them in my view.

DevWithSigns
  • 725
  • 16
  • 33

1 Answers1

0

ImapX is usable with ASP.Net MVC without any problems. However, looking at your code, I see that you're using GMail.

It often happens that once you try to sign into your GMail account from a different place (e.g after deployment to a server), Google will block it for security reasons and ask you to enter a captcha.

For a similar case you can take a look at this thread in the official forums of ImapX. The problem itself can be solved by logging into your account through the browser on the machine where you run your ASP.Net application and unblocking it.

I also answered your question in the official forums.

Pavel Azanov
  • 188
  • 1
  • 11
  • i have sent you an email with attachment of log text file at info@imapx.org, and also post this reply on discussion forum at codeplex, please review and guide me because i'm just stucked into this problem since many days, even i didn't found any suitable solution on internet regarding this problem, i have also mentioned the exception detail in email. i cannot retrieve inbox messages bodies and cannot embed them in my MVC View. please guide me with best solution. i'm waiting for your reply – DevWithSigns May 14 '14 at 23:32