This question might be flagged as a duplicate But it is not. Because the code sends email successfully when using normal gmail account that ends with @gmail.com. The problem only happens when using G suit accounts that are custom and ends with @yourdomainname.com.
I am using this code to send email. My account has two-step verification so I created an app password for verification and use it to send email.
using (var mm = new MailMessage(PrivateSettings.SenderEmail, message.Destination))
{
mm.Subject = message.Subject;
mm.Body = message.Body;
mm.IsBodyHtml = true;
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
EnableSsl = true
};
var networkCred = new NetworkCredential(PrivateSettings.SenderEmail, PrivateSettings.EmailPassword);
smtp.UseDefaultCredentials = true;
smtp.Credentials = networkCred;
smtp.Port = 587;
smtp.Send(mm);
}
The above code sends email successfully when I use my normal gmail account which is se.natnael.zeleke@gmail.com.
But when I use one of my G Suit account , connect@tatarri.com , to send email it fails and shows this error message.
So my question is; is their additional configuration that should be done for G suit gmail accounts.
Additional Info.
I configured both email accounts to use app password. connect@tatarri.com is also registered as admin in my G suit account.
Both email accounts have their IMAP enabled in settings.
I bought tatarri.com domain name from namecheap.
Thank you.