Can't send email using email function in Google Cloud Platform - google-app-engine

We have G Suite account with our domain name. And our server is Google Cloud Platform. We are using PHP for our development, we trying different code for sending mails, but cant receive any mails using mail functions, and we contact G Suite account they said all the settings are working perfectly... This issue is regarding Google Cloud Platform, cloud reject the mails.
Is any additional settings needed to implement on Google Cloud Platform to establish a connection with G suite account?
Should we have an App Engine account for sending email via code?
Any ideas on what might be happening here or what to test next?

Disclosure: I am a product manager on Google Cloud Platform (though not the products discussed here specifically).
Note that outgoing connections on port 25 (SMTP) are disabled, so you cannot use that for sending email programmatically. This is probably the issue that you're running into.
Here are some alternatives, depending on what server product you are using:
Google App Engine (GAE): use the Mail API
Google Compute Engine (GCE) or Google Container Engine (GKE):
send email via G Suite domain, or
work with one of our email partners, such as SendGrid, Mailgun, or Mailjet

Related

Why javax.mail packages in google app engine sdk?

I can find javax.mail packages in google app engine sdk. Can anyone tell me the purpose of including such packages in google app engine where we already have a dedicated jar ( java mail) for these packages in market.
Control of the environment. When the JavaMail API is provided it allows GAE to control what mail server and javamail providers are used for sending and receiving.
From the Overview of Sockets API for Java:
Sockets are only available for paid apps, and traffic from sockets is billed as outgoing bandwidth.
[snip]
Port 25 (SMTP) is blocked;
The GAE javax.mail API provides email to free GAE accounts where as if you had to include a jar you would have to get a paid GAE account to send or receive email.

Is there a way of checking if a Web Application or Website using the Google App Engine?

I am trying to figure out whether to use Google App Engine or other available PaaS. During my research, I am trying to figure out if a particular website using google app engine or not - Is there any known method to figure this out ?
Sorry for the basic question, but appreciate any help. Thanks.
You can recognize a GAE-based site based on the server's domain:
*.appspot.com - default domain of standard GAE apps
*.appspot-preview.com - default domain of newer flex GAE apps
custom domains mapped to ghs.google.com or ghs.googlehosted.com. See step 5 in the Adding a custom domain for your application procedure and how does ghs.google.com work?. Note that I'm unsure if this doesn't also apply to other Google products, not only to GAE.
There may be other such domains as well.
You can also check the Server header in the responses coming from the site. From Headers added or replaced:
Server
Set to Google Frontend. The development server sets this to
Development/x, where x is the version number.
ping the domain and if you have something with ghs.googlehosted.com:
PING ghs.googlehosted.com (216.58.213.147): 56 data bytes
It's a GAE application. You can also check the headers in requests from your browser's dev tools.

google app engine not able to connect to outlook mailbox

I are trying to read emails from an outlook mailbox using javamail api. The protocol for this mail reading is imap. Google SDK comes with java mail API but it doesn’t support imap protocol. For the purpose I need to include java mail api libraries in pom.xml. Now there are two copies of javamail api in app engine project, one that comes with google sdk and the other one from pom.xml. During execution of java code to connect to mailserver, app engine is not able make a connection sometimes. The behavior is not consistent as GAE might be loading java mail api in random order. When GAE doesn't connect to mailbox, i see the following error:
javax.mail.MessagingException: No login methods supported!
(com.sun.mail.iap.ProtocolException: No login methods supported!)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:477)
at javax.mail.Service.connect(Service.java:248)
at javax.mail.Service.connect(Service.java:91)
at com.disney.util.MailBoxConnector.connect(MailBoxConnector.java:48)
I could not find a workaround for this problem. Any suggestion will be greatly appreciated.

Getting SSL error in google app engine

I have created google app engine application. It works fine in my local system and also deployee successfully on server. but that url http://****.appspot.com/_ah/api/employeeendpoint/v1/employee/1 gives me below response.
{"error":{"errors":[{"domain":"global","reason":"sslRequired","message":"SSL is required to perform this operation."}],"code":403,"message":"SSL is required to perform this operation."}}
I have also try with https://****.appspot.com/_ah/api/employeeendpoint/v1/employee/1 but still not working.
Certain Google Cloud Platform products require SSL, you can simply enable SSL from your Cloud Console and it should work.
The documentation for App Engine, for Compute Engine, and for Cloud SQL.

Gtalk Service On Google App Engine Using Python

I searched a lot for built web service like Google Talk, using Google Application Engine and Python.
For that first step is to check the status of online user on the Gmail. I found many code of it on python using XMPP library but it work only on python not using Google Application Engine.
There is also suggestion of using XMPP python API but for sending message we have to provide JID like app-id#appspot.com and message send.We can not send message from one email Id to another Email Id directly.
Now I want to perform Oauth authentication in python for gtalk at domain level can anyone tell me how to do this?
I think you are confused. Python runs ON appengine. Also theres a working java xmpp example provided.
You can only send messages from your app. There are two options: your_app_id#appspot.com or anything#your_app_id.appspotchat.com.
If you wanted to behave like an arbitrary xmpp client, you'll have to use a third party xmpp library running over HTTP and handle the authentication with the user's XMPP server.

Resources