From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-20-2009 01:35 AM
Hello,
I am using SMTP Email Send File.vi to send email using LabVIEW. I am planning to add a png/bmp image as an email attachment and was wondering if it can be inserted in the email content. This way, the attachment does not have to be double-clicked to be opened, but can rather be viewed directly with the email.
Thanks.
10-20-2009 04:10 PM
The setting that's keeping you from placing HTML code (and therefore an image) into the message is found in NI_SMTPEmail.lvlib:SMTP Email MIME Text Content-Type.vi. There is a string input that contains "text/plain" which specifies that your message is converted to UTF-8. If you change this to "text/html" you can put straight HTML into your message text and use an <img> tag. The only caveat to this with your situation is that you have to have the image hosted somewhere before you can use it in this tag. However, there are several free image hosting sites that you can use.
Since these are VIs included in LabVIEW though, you will probably want to make a copy of the library and make the changes there. This isn't a big change but still better to be safe.
10-20-2009 04:59 PM
Thanks, Alex.
I will check out the html format for email.
I had a question regarding the caveat that you mentioned:
"The only caveat to this with your situation is that you have to have the image hosted somewhere before you can use it in this tag. However, there are several free image hosting sites that you can use."
The image is basically a plot generated in LabVIEW that is converted to bmp that I plan to include in the email. Do I still need to have it hosted somewhere? Thank you.
10-21-2009 09:40 AM
If you want to actually embed the image in the email you have to use the HTML <img> tag as discussed above. This tag requires that you provide the source of the image as a URL so that it has something to point to when displayed to the end user. There may be some way out there to embed the image without hosting it, but this is the solution I was able to get to work.
If you need to find one of the free hosting sites, just search for "free image hosting". ImageShack, Photobucket, and TinyPic are some of the sites I am familiar with.
10-26-2009 12:39 PM
Thanks again, Alex.
I was able to embed the image in the email per your suggestion. The embedded image can be viewed in the email in Outlook. However, the same email in webmail shows a red X (image does not get displayed).
I am using the following tag:
<img src="smiley.gif" alt="" />
I was wondering if there was something that I might have missed. Comments/suggestions are welcome. Thank you.
10-30-2009 02:56 PM
03-30-2016 05:33 AM
Can i get code?
with html tag i couldn't get results.
03-30-2016 06:05 AM
You could try embedding the image as a base64 encoded string in the html:
<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
Take the png file (or another file type...you'll need to change the meta type), base64 encode the contents and then put it after the comma.
08-05-2019 03:04 PM
Hi, I know this is an old post and I'm sorry for resurrecting it, but I'm having "red X" problems too. Has anyone found solution to this one?