By default, Google mail server will deny sending email from their servers. To enable additional host/application to send email you must add additional host/application records to the routing email section.
If you try to send an email from your application without setting this up, you will get the following error message: “5.7.1 Invalid credentials for relay“.
1. Go to Google Admin
2. Go to the Advance Settings
Apps -> G Suite -> Settings for Gmail -> Advanced settings
3. Add Additional “SMTP relay service” record to the Routing section.
- Name: xxxxxxxxx
- Allowed senders: Any addresses (not recommended)
- Only accept mail from the specified IP addresses: Yes
- Allowed IP addresses: xx.xx.xx.xx
- Require SMTP Authentication: No
- Require TLS encryption: No
4. After you have add additional “SMTP relay service” record , be sure to save the settings.