Page 2 of 3

Using Sendgrid in a list

Posted: Fri Oct 17, 2014 2:29 pm
by Mike6979865

Thank you so much! You guys are just great!


Using Sendgrid in a list

Posted: Fri Oct 17, 2014 3:28 pm
by Mike6979865

This worked, thank you. But my other question is that I have an image, and I want to send the link to an image. I'm able to embed the image in an email, but it's not a good idea because most web mail clients don't display embedded images. Is it possible to display the picture, or send the picture to a third party, and generate a link within an email. Have this been done before? Any ideas?


Using Sendgrid in a list

Posted: Fri Oct 17, 2014 3:50 pm
by Mike6979865

Thank you, it worked, and here's another challenge I'm facing. The list display a picture, and I want to be able to email the link of the image that is stored in the database so they can download the image. The database is secure, and the image gets stored as binary and not in the Files collection. I don't want to embed the image since it may not be viewable by all mail clients. What's a good solution? I don't mind storing the image that I want to email the link to in an unsecured collection. Can I get the path to the image and include in an email even though the database is secure? Thank you,


Using Sendgrid in a list

Posted: Mon Oct 20, 2014 12:22 pm
by Evgene Karachevtsev

Hello Mike,

Sorry for radio silence here. Could you please specify, what do you mean with "stored as binary and not in the Files collection"? Is this where you keep it as binary and not in the Files collection?


Using Sendgrid in a list

Posted: Mon Oct 20, 2014 3:26 pm
by Mike6979865

I meant that the image is saved as a string in a collection.

But, my intention from all of this is to actually have a link included in an email so that when people receive the email they can download the image. Is this possible? The code provided above works perfect on all text fields, but not for images.

Regards,


Using Sendgrid in a list

Posted: Tue Oct 21, 2014 2:43 pm
by Mike6979865

Any ideas on how that can be implemented? I need to have the image emailed from the list (attached), or a link provided in the email to the image. Please assist.


Using Sendgrid in a list

Posted: Wed Oct 22, 2014 4:08 pm
by Mike6979865

Hello, I managed to create a drop down list with emails, and email all the text fields provided in the list.

However, I still need to figure out either to send the image as an attachment in an email, or to provide a link to the image so it can be downloaded.

The images display fine in the list. In the database, they are saved as base 64 string. For example: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj...

The column field in the database is a string.

I'm using Sendgrid. Any suggestions how can I email the image, or provide a link?

Regards,


Using Sendgrid in a list

Posted: Wed Oct 22, 2014 5:42 pm
by Kateryna Grynko

Hi Mike,

For now, we can suggest 2 options:

  1. Paste base64 in a URL itself, for example:
    prehref="data:image/jpeg;base64,..."/pre
  2. Insert an codeimg/code tag with an appropriate src into your letter, or embed it in CSS: http://stackoverflow.com/questions/12...

Using Sendgrid in a list

Posted: Wed Oct 22, 2014 6:04 pm
by Mike6979865

Hi,
How can I implement that in this code. I tried various variations and it didn't work since the image is placed in a list. It order to show images, I usually use store the image in local storage, and use this code: Image: localStorage.getItem('picture') ? "Image": ""
But, I don't know how to implement that in this case... The code that works without the image is at follows:

var res = "",
listItem = $(this).closest('[name="mobilelistitem_25"]'),
name = $('[name="name"]', listItem ).text(),
email = $('[name="email"]', listItem ).text(),
data = {
Name: name ? name : "",
Email: email ? email : "",
},
ii;
for (ii in data){
if (data[ii] !== ''){
res += "span" + ii + "/span : span " + data[ii] + "/span";
}
}
res += "";
localStorage.setItem('email',res);


Using Sendgrid in a list

Posted: Thu Oct 23, 2014 6:17 am
by Evgene Karachevtsev

Hello Mike,

If in local storage variable picture is in base64, then please try this:
pre codevar res = "",
listItem = $(this).closest('[name="mobilelistitem_25"]'),
name = $('[name="name"]', listItem ).text(),
email = $('[name="email"]', listItem ).text(),
image = localStorage.getItem('picture'),
data = {
Name: name ? name : "",
Email: email ? email : "",
Image: image ? "<a href='" + image +"'>Image Link</a>" : ""
},
ii;
for (ii in data){
if (data[ii] !== "){
res += "" + ii + " : " + data[ii] + "&quot
}
}
res += "&quot
localStorage&#46;setItem('email',res);/code /pre