The error message that is shown is:

Authentication failed. Please check your username/password.
[Server response: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsMJ 534-5.7.14 CTtZOwFdid3ZTKA67P5RtaDoBRDQfHufdOoVjcwSkRfoSbp–tQ6wHzEg2u3chKc2oHOPi 534-5.7.14 3FIbd9gguTpN6ApPcJWOxNd1HvAxUPIbp4Lq6XvKnXrUFgJ_jow3LjqN77bfFu9q-yNqy8 534-5.7.14 qvh11ZCyaqb_JelAWCazjfJxWalf6lQGmnv8HY86uLYlzHYD7B4sMlAwarCH6ct7b_uj-W 534-5.7.14 -UkWoOg> Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754m5sm2472642wjx.16 – gsmtp code(534) ]

Solution:

The only solution which worked for me, is to enable Two-step verification for the account whose mail is to be retrieved, create a one time password, and use this password in the Google Apps account which will be retrieving/sending as the Google Account. Once this is done, you may safely disable two-step verification without revoking the one-time password.