2

I have some doubts regarding configuring email in Google Cloud service with existing applications

1.we configured the SMTP using gmail account with port 587 & try to sent mail from our google cloud instance, no email is sent.We try to ping to the port 587, it shows connection refused. Why it is happened?

2.we have seen an option to sent email using SMTP-Relay in Google cloud platform. How can we configure & setup SMTP with Google Apps email/gmail using SMTP-Relay set up?

  1. Is there any option to send emails from google cloud for our existing application like mantis without using third-party partners like SendGrid, Mailgun and Mailjet?
Shamseer
  • 21
  • 2
  • Do you mean you tried to telnet to port 587 of smtp.gmail.com ?. If you cannot telnet, then you should contact Google Cloud support – Nadir Latif Dec 14 '16 at 09:25

3 Answers3

1

I was able to send email from our Google Compute instance using following mailx command:

# the body of the alert email is saved to a temprary file
echo "Hello. This is a test message" > /tmp/mail_body.txt
# the mailx command is used to send the email. it sends the email using gmail server.
# this is useful on servers that have limited access to email servers such as Google Compute instance
mailx -s "Email Subject" -r "reply_email" -S smtp="smtp.gmail.com:587" -S    \
smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="gmail_address" -S smtp-auth-password="gmail_password" -S \
ssl-verify=ignore recepiant_email < /tmp/mail_body.txt
# the temprary file is removed
rm -rf /tmp/mail_body
Nadir Latif
  • 3,690
  • 1
  • 15
  • 24
0

You cannot use port 587 since GCP block all outbound traffic from that port, I suggest you use port 2525 since that's the only smtp port that GCP does not block.

Kalana Demel
  • 3,220
  • 3
  • 21
  • 34
0

Google Cloud Engine blocks outbound traffic on 587, Try using the port 2587.

XuDing
  • 1,982
  • 18
  • 27