Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Thank you so much! You guys are just great!

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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?

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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,

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

Using Sendgrid in a list

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?

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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,

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using Sendgrid in a list

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...
Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

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);

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

Using Sendgrid in a list

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

Return to “Issues”