Upload file in Google cloud and Mail using App engine.

218 views
Skip to first unread message

Snahasish Ghosh

unread,
Sep 12, 2015, 7:12:02 AM9/12/15
to Google App Engine

Hi, 

I am new in Google app engine.

I need some help and suggestion from you.


I have an project in Google app engine,

for example http://devSend.appspot.com/


I have another application written in GWT 2.7.0 and SmartGWT5.1 and deployed in Tomcat 7 java 1.8 (64 bit).

From this application I want to upload a file(.np3) https://devSend.appspot.com/devstore/indfs01 location.

Also I want to send mail using Google app engine from http://devSendsend.appspot.com/devsend.


All the path are configured.


Is it possible to achieve this ?


From where I have to start ?


Please help me.


Regards


Snahasish



Nick (Cloud Platform Support)

unread,
Sep 14, 2015, 12:13:30 PM9/14/15
to Google App Engine
Hi Snahasish,

It's definitely possible to do what you're thinking of. You can use Cloud Storage or Blobstore to upload and read files to/from your App Engine instances, and you can use the Mail API or Sendgrid to send the mail. You should use Sendgrid if you intend to use more than the quota allowed for the Mail API. 

I hope you are able to find what you need by reading in the docs related to those services. 

Sincerely,

Nick

PK

unread,
Sep 14, 2015, 12:33:03 PM9/14/15
to google-a...@googlegroups.com
Unfortunately, the send mail API does not have a way to send as an attachment files from cloud storage. In our applications, this forces us to read the whole attachment to main memory and then use the mail API to send it. For big attachments this quickly overwhelms small footprint instances.

The same goes for incoming e-mail with attachments, it would be nice to go directly to cloud storage.


Does anybody have experience how this would work with sendgrid? Can I stream an big attachment to a storage location and then send an e-mail referring to that location and the same for incoming messages with attachments?

-- 
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/9a0ee09a-6259-4c1b-96f3-219517ed8904%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Nick (Cloud Platform Support)

unread,
Sep 14, 2015, 12:51:29 PM9/14/15
to Google App Engine
Hey PK,

The Mail API is really meant for more admin-purpose mail sending, and if you have a requirement for mass email sending, heavy attachments, or advanced features, Sendgrid is really the way to go. To overcome the problem of reading files into memory, you could always create links on your own app which map to a given file and would send a redirect response to the temporary signed serving URL for the Cloud Storage object. This will make your mail messages much smaller and faster as well.

If you're interested in sending attachments themselves, you will have to load the data into memory in order to send the email, since the bytes have to actually be written into the body of the message, and this is no different as for any email service. The mail message simply has to contain the data of the file. Of course in theory the infrastructure could find a way to insert this into some kind of proto-messsage lacking the file data which is intercepted, filled, and then sent on its way, you'd need to make a feature request, which you've already done, so that's good. 

Best wishes,

Nick
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsub...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Snahasish Ghosh

unread,
Sep 14, 2015, 1:35:26 PM9/14/15
to google-a...@googlegroups.com, pay...@google.com

Hi,
Thanks you for your reply. Can you please suggests me,from where I should start. Actually my main concern is that I have to communicate Google app engine project from another project which is deployed in Tomcat server. Today I try to achieve this using Remote API calling but unable as there is an error saying that appid can't found. Error 404.
I have already posted this error in the group.
I would like to request you to go through that post and/or suggest me a path from where I should start.

and I try to use Remote API, is it the correct approach ??

I am going to call remote API from non app engine application and try to connect with a app engine application.

please help me in this two point.

Regards
Snahasish

Sent from my Xiaomi

You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/k3kWBQ1YIL0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ed958c63-0522-4c03-8c31-3281bce6ef1d%40googlegroups.com.

Nick (Cloud Platform Support)

unread,
Sep 14, 2015, 5:01:55 PM9/14/15
to Google App Engine, pay...@google.com
Hey Snahasis,

If you received a 404 response, it's because the resource requested doesn't exist. Perhaps something was mis-spelled, or a configuration step was missed. As to your question "where to start", I'd suggest reading the docs for the relevant services which I linked above. 

Best wishes,

Nick
To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.

To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.

PK

unread,
Sep 14, 2015, 5:29:56 PM9/14/15
to google-a...@googlegroups.com
Hi Nick,

1. Can you please point me to your documentation and marketing material where it states:  "The Mail API is really meant for more admin-purpose mail sending”. Even if you added recently, when I built my app this was not there. But even then admins needs attachments too.
2. What you call the “in theory” stuff is where I expect Google to add value by integrating all the pieces together and provide superior performance. You are the only ones you can do it.
3. Google App Engine mail works mostly great for my purposes. I can find another API mail vendor who offers me uploading my files to Amazon S3 and then send them from their service but I would need two more accounts, a lot of data moving in and out from multiple services (you know egress data is expensive, right???) the whole reason I use GAE is to find pretty much all the services in one place and not having to move data around the internet.

I hope your product managers take a look at this because it really shows a use case that only Google can efficiently do by putting all your services to work together.

1. Use GAE to upload a file into GCS
2. Send an e-mail that refers that file as an attachment

OR

1. An incoming e-mail arrives with attachments
2. The attachments are immediately stored in a  bucket in GCS
3. The API delivers a manageable message to my GAE with pointers to the attachments in GCS

Hey think, beautiful demos that show three of your services playing together in a future Google I/O, and a customer (me) behind it already using it…

Best,


To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Snahasish Ghosh

unread,
Sep 15, 2015, 6:09:00 AM9/15/15
to Google App Engine, pay...@google.com

Hi Nick

I have few questing.  Can you please clearly.

1. Is Remote API using is the correct approach to fulfill my requirement ?

2. As per https://cloud.google.com/appengine/docs/java/tools/remoteapi
 
<servlet>
   
<display-name>Remote API Servlet</display-name>
   
<servlet-name>RemoteApiServlet</servlet-name>
   
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
   
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
   
<servlet-name>RemoteApiServlet</servlet-name>
   
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>

where this servlet will be defined ?
1. Is it in my java application which is deployed in Tomcat (not in app engine) or
2. within web.xml of app engine application. (this application is deployed in App Engine.) ?
3. or in both place.


Thanks

Snahasish

Nick (Cloud Platform Support)

unread,
Sep 21, 2015, 3:00:09 PM9/21/15
to Google App Engine
Hey PK,

Thanks for your questions. I'll answer them numerically:

1. I wasn't speaking from the docs but making an inference based on the limitations on the use of the Mail API, and the fact that our documentation on Sendgrid speaks of it as a good solution for bulk emails. 

2. As mentioned, you can make a feature request for such a feature and it will be triaged and implemented depending on the amount of stars on the feature request and the plans of our developers.

To make a feature request for a feature you desire is the best way to get your idea to Product Managers, Engineers or anybody else who can make a decision. The use-case you outline is quite clear, and I encourage you to make that feature request. 

Best wishes,

Nick
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.

To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.

Nick (Cloud Platform Support)

unread,
Sep 21, 2015, 3:05:31 PM9/21/15
to Google App Engine, pay...@google.com
Hey Snahasish,

The Remote API is useful in some ways, and other solutions would be useful in other ways. You can use the remote API to connect to your instance and execute code in that context. If you use that code to call the Mail API, that's one way to call the Mail API.

If you're still confused about how to use the Remote API, I suggest re-reading the documentation which will clearly explain the steps to get it set up. To answer your main question specifically, the servlet configuration you provided should be in web.xml of the deployed application. Your local (tomcat) application should connect to the remote app's remote API. In the docs, the section "Configuring Remote API on the Server" describes what should happen on your App Engine app, and the other two sections describe how to connect from a standalone client (your tomcat server) or another App Engine context. 

Best wishes,

Nick
Reply all
Reply to author
Forward
0 new messages