Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable applications to send email from google container engine

I am using a third party app in google container engine. It expects SMTP to be configured on default port(25) of localhost.

Since I cannot configure SMTP URL for the application and google cloud doesn't allow usage of SMTP ports, is there any way by which I can send emails from GKE.

like image 900
pradex Avatar asked Oct 20 '15 21:10

pradex


People also ask

How do I send an email from GCP?

To send email from GCP, you first need to create an account. Once you have an account, you can create an email address and set up your GCP account to use that address for email. You can also use your GCP account to access your email messages in the Gmail web interface or through the Google Cloud Platform Console.

Does Gmail still support SMTP?

Yes! You can use the SMTP server even if you've enabled two-factor authentication on your Google account. However, you will need to generate an app password so that the app can still connect.


1 Answers

If you are using Kubernetes, you can send mails by adding a sidekick Emailrelay container to your pod.

Emailrelay can run as-a-proxy. It listens on port 25 of localhost and forwards mails to an external SMTP server. It also supports authentication with outbound server and STARTTLS. Sample command will be like

emailrelay --no-daemon --as-proxy external.smtp.server:<PORT> --client-tls --client-auth /path/to/smtp/auth

Credentials file needs to be in format

LOGIN client username password

where, 'username' and 'password' should to be xtext encoded.

To overcome google cloud limitations, external server needs to accept SMTP requests on custom port.

like image 138
Sunil Kumar Avatar answered Sep 20 '22 12:09

Sunil Kumar