0

Here's the dilemma I'm presented with. I've coded up an APP in xamarin where I'm utilizing google SMTP to send notifications to another gmail account.

I have the code set up like so

using (var client = new SmtpClient())
{
 client.Connect("smtp.gmail.com", 465, true);    
 client.AuthenticationMechanisms.Remove("XOAUTH2");
 client.Authenticate("gmailUserName", "gmailPassword");

 client.Send(message);
...
...

However, when the App is downloaded by others outside of my state, their notifications are being rejected. I've tried downloading the same app on various devices and the emails were sent successfully. Which leads me to conclude that for whatever reason the SMTP access is being rejected if a user is outside of the state. And yes, I do have the 2 step verification turned off. and I am allowing Less Secure Apps to access.

Any feedback will be much appreciated.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • maybe this can help you [google oauth c#](http://stackoverflow.com/questions/24195508/smtp-and-oauth-2) – hpfs Oct 15 '16 at 03:09

2 Answers2

0

Most likely Google limits the number of messages you can send and/or IP addresses you can login from using the same account within a short period of time as an anti-abuse measure.

You might need to setup your own SMTP server or use another SMTP server that does not implement similar measures.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
0

Google SMTP does allow only 99 emails sent a day, but that wasn't an issue. I gave up on google and created a yahoo account with the following configuration, and that did the trick.

Server - smtp.mail.yahoo.com

Port - 465 or 587

Requires SSL - Yes

Requires TLS - Yes (if available)

Requires authentication - Yes

Source: https://help.yahoo.com/kb/SLN4724.html