AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

hello, I have read some posts here and tried to use those info to make my app work. But I have some problems and hope the appery staff can help me out.

First, I got some variables and I want to include them in the end of email text.

So, I referred some post suggestions and I make a JAVA script in the mapping (shown in the pic). But when I test it on my device, i can got those email but the email text didnt show. Only the variables shown in the email.

Also, I was trying to start a new line between each varibale, but they didn't start in the new line.

please help!

Image

Image

Jon Haider
Posts: 0
Joined: Thu Oct 16, 2014 2:53 pm

a question about sendgrid email body text

When you say: return mailtext, you haven't defined what mailtext is...
You should have a statement somewhere above that says:
pre
var mailtext = "Hey, here's some info about your Energy Status, blah blah blah"
/pre

Then it wouldn't be undefined ;)

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

hi Jon, The mailtext variable suppose to be the input of the email meaasge box.

I am not sure how to set this variable and combine the other local storage variables together when they sent out to different email address. Please advice.

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

I fixed the new line problem. But still, my email body text cant be sent, it is always replaced by those varibles.

my ideal format supposed to be :
email body text (blah, blah, blah)
variable 1
variable 2

now my sent-out email is received like this
variable 1
variable 2

(no email body text, is it been overwritten?)

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

nevermind, I have fixed the problem . The other question is how can i send the photo_buffer with the email via sengrid, the post here still confuse me....sorry, pleas help/

Jon Haider
Posts: 0
Joined: Thu Oct 16, 2014 2:53 pm

a question about sendgrid email body text

If you look here:
https://sendgrid.com/blog/embedding-i...
Sending the base64 buffer in sendGrid will be blocked in Outlook, so maybe you're better off uploading the image somewhere and just include it as a referenced url.

If you have to use the photo_buffer, then save the base64 string in a local storage variable, call on it from the script:
pre
var photoBuffer = localStorage.getItem("photo_buffer")
/pre

and then you can send this variable as as a file in the params object:

prevar params = {

files: [
{
filename: 'image.jpg',
contentType: 'image/jpeg',
cid: 'myimagecid',
content: (photoBuffer | Buffer)
}
],
}
/pre

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

thx Jon, I will try this code right now

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

Hi jon, I tried ur suggestion but it didnt work, I have attached the pic below. Can u help me to check it? Thx

Jon Haider
Posts: 0
Joined: Thu Oct 16, 2014 2:53 pm

a question about sendgrid email body text

Not sure. It seems like you want to look into the sendGrid documentation more. I've never used sendGrid either, but I will be attempting to add it to my app soon as well...

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

a question about sendgrid email body text

hi jon, i set up a new para called emailpic and map it with the local storage "photo_buffer". inside the emailpic, I used ur code but it didnt work. There must be something wrong with my codeing, please advice.

Image

Image

Return to “Issues”