Hello Snahasish,

You are having troubles with which step? download a file stored in GCS or 
attaching the file through the SendGrid API? Are you using any library to 
interact with SendGrid (https://github.com/sendgrid/sendgrid-java)?

If you're using the SendGrid library have you tried attaching the 
InputStream as shown here? 
https://github.com/sendgrid/sendgrid-java#attachments 


I'm doing exactly the same but with another mail provider instead of 
SendGrid. I'm using jersey with *FormDataMultiPart* and 
*StreamDataBodyPart *classes to send the request with the attachment to the 
API (with no specific client library, just Jersey)


FormDataMultiPart formData = new FormDataMultiPart();
formData.field("from", emailFrom);
formData.field("subject", subject);
formData.field("html", content);
formData.field("to", email);

StreamDataBodyPart bodyPart = new StreamDataBodyPart("inline", 
imageInputStream,filename,new MediaType("image","png"));
formData.bodyPart(bodyPart);

Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api", API_KEY));
WebResource webResource = client.resource(API_ENDPOINT + "/messages");
webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, 
formData);


Let me know if this is what you are looking for.

Cheers.



El lunes, 19 de octubre de 2015, 12:25:10 (UTC+2), snahasis ghosh escribió:
>
>
> Hi Google Cloud Support
>
> I want your suggestion for sending mail with attachments from Google Cloud 
> Storage.
>
> Currently I upload a file(.mp3) in Google Cloud Storage within the 
> specific bucket using App Engine Java Client.
>
> I want to send this file (.mp3) as an attachment with the mail and mail 
> will be send from another Java Web Application which is connected to Google 
> Cloud Storage using App Engine Java Client.
>
> As mentioned by Nick in an earlier post, I go through SendGrid 
> documentation but can't find a suitable documentation about how to attach 
> an file with mail and send.
>
> Can you please help me what should be the best way ?
>
> -Snahasish
>

-- 
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-appengine+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/246a9ebe-e1d1-4b0b-a5e9-8665905eb165%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to