Page 4 of 5

Sending 2 page HTML email with SendGrid

Posted: Mon Dec 29, 2014 2:22 pm
by Bruce Stuart

Yurii,

So - after doing more digging - under your solution, 1.2 above - you show me what the headers look like, and what the body looks like - you didn't share what's on the query tab?

Along that line - where am I telling this redirector - that sendgrid is the destination to send the 'body' to? Is it on the query tab or how is that handled??

Best,

Bruce


Sending 2 page HTML email with SendGrid

Posted: Mon Dec 29, 2014 8:48 pm
by Bruce Stuart

Yurii,

Ok .... Thanks for taking the evening off your time as I determined that I was being a bit 'literal' in my implementation of your guidance... And you meant for me to put: https://api.sendgrid.com/api/mail.sen... .... In the url line of the mail.sending.service ....

So, good news ... I got it to send an email just now by making that oh so simple change.

Only remaining challenge is the code above grabs the text version of my source for my html email. What's the proper syntax for getting the HTML source from an Appery HTML object on a page ??? Haven't found that tip yet here...

Best,
Bruce


Sending 2 page HTML email with SendGrid

Posted: Mon Dec 29, 2014 10:03 pm
by Bruce Stuart

Ok ... We're done! Found the method to retrieve the html source from a screen html object type ( object.html() ... Go figure !!

Works awesome and thank you very much ! Lifesaver !!!


Sending 2 page HTML email with SendGrid

Posted: Mon Dec 29, 2014 10:04 pm
by Yurii Orishchuk

Hi Bruce,

You look into wrong request.

Details: http://news.finance.ua/ru/news/~/341554

You need to look into following request: http://prntscr.com/5mdudg/direct

I can suggest you to disable weinre remote debugger.

Also, if you can not manage this problem - please give us your app public and describe steps to reproduce this problem...

Regards.


Sending 2 page HTML email with SendGrid

Posted: Mon Dec 29, 2014 10:10 pm
by Yurii Orishchuk

Bruce,

Sorry, did not see your response..

Glad it works.

Regards.


Sending 2 page HTML email with SendGrid

Posted: Mon Feb 02, 2015 11:04 pm
by Bruce Stuart

We can mark this one solved & answered ! All done on this one. Thanks for all the support fixing this problem. Client is very happy with the outcome.... thanks to you all.

Best,

Bruce


Sending 2 page HTML email with SendGrid

Posted: Tue Feb 10, 2015 4:19 pm
by Bruce Stuart

Open question on this thread - if I have a field in a database with a photo image attached - can I send it using server-code using this technique? How do I include the sendgrid API in the server code?


Sending 2 page HTML email with SendGrid

Posted: Tue Feb 10, 2015 5:50 pm
by Evgene Karachevtsev

Hello Bruce,

You are not including Sendgrid API, you are using it with the requests, and yes, you can use such approach in server-code script, but the js will be different.


Sending 2 page HTML email with SendGrid

Posted: Tue Feb 10, 2015 10:41 pm
by Bruce Stuart

Evgene,

Thanks - that makes sense. I've spent the morning learning how to do the work here. First challenge - execution time. Looks like I need to change my plan or be more efficient or limit my results. I'll let that thread mature.

Thanks again..

Bruce


Sending 2 page HTML email with SendGrid

Posted: Mon Feb 16, 2015 12:29 am
by Bruce Stuart

Question on this thread - related to attachments - specifically - sending photo - image attachments - Yurii's example above shows this processing for images (i understand the logic) but...

//Here you can specify needed fileContent.
var fileContent = 'Hi';
//where "testFileName.txt" is your attach file name.
var fileName = 'ZZZ.txt';
var blob = new Blob([fileContent], { type: "text/xml"});
var formData = new FormData();
formData.append("files[" + fileName + "]", blob);

// now the question - for sending an image - what's the type?? and what's the filecontent.

Specifically - I have images stored in a collection called 'attachments' - the image is stored in a column called 'sphotoorother' - and it begins with (first 50 or so characters - example):

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAA

For purposes of sending this via sendGrid - do I tell it the type is ''image/jpeg' ?' ...

for fileContent - do I take the entire image stored in the column where I have my image stored - and load it here - or do I strip off the header (the "data:image/jpeg:base64,/" in my example from above...?

to I create a filename - say what it was called originally plus the implied extension - so say 384310.jpeg - and use that in the formData append statement above where fileName is shown ???

Thanks!
Bruce