Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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 !!!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Sending 2 page HTML email with SendGrid

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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Sending 2 page HTML email with SendGrid

Bruce,

Sorry, did not see your response..

Glad it works.

Regards.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Sending 2 page HTML email with SendGrid

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.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Sending 2 page HTML email with SendGrid

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

Return to “Issues”