cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Displaying image in email help

jmay1
5-Regular Member

Displaying image in email help

I am using the SendMessage service of a mail server thing. The following syntax will show the image in an email if I bring it up on my iPhone, but not if I open it up on my PC. Anyone know why? Also, how do I get the URL of a media entity? This is a random test url that I used here but I need to be sending a media entity picture in the email and I don't see where the url can be found.

Thanks in advance for the help. (some info replaced with astericks)

Jenna

var params = {

                cc: undefined /* STRING */,

                bcc: undefined /* STRING */,

                subject: source + "-" + CustomerName + "- " + "Red Humidity Alarm = " + Things[source].CellHealthTestTankHumidity /* STRING */,

                from: "***@***.com" /* STRING */,

                to: "***@****.com" /* STRING */,

    body: eventData.description +

"<br> TALKING POINTS:"  +

"<br> ****** was notified of an issue concerning the high pressure system and will be sending a FSE out to correct" +

"<br> the concern immediately." +

"<br> **************************************************************************************************" +

"<br> The CASE generated for this customer should have the following PSCA codes:" +

"<br>     - Problem Code - High pressure system" +

"<br>     - Symptom Code - Humidity alarm" +

"<br>     - Cause Code - Dryer" +

"<br>     - Action Code - Replace Dryer" +

"<br> **************************************************************************************************" +

"<br> *******FSE Resolution Steps to determine the issue.******" +

"<br> Determine if the site is currently using UL or Non UL dryers? " +

"<br> <img src=\"https://www.binarymoon.co.uk/wp-content/uploads/2012/04/draw-something-unicorn-e1334932907258.png\" alt=\"Dryer Image\" style=\"width:128px;height:128px;\">" +

"<br>  We will need to validate the following if not already done so:" +

"<br>  1- Clean Heat exchanger. You will need to remove it and separate from the fan to clean. See PM document for detailed instructions." +

"<br>  2- Validate the water level in Bulk Water site window is no more than 5/8 full and the hose going into the evaporator is not kinked or restricted" +

"<br>  3- Validate the Fan on Heat Exchanger is operating correctly and properly oriented " +

"<br>  4- Length of time to charge the HP from 0 to 90" +

"<br>  5- Cut-in and Out pressures for Compressor on the Condor " +

"<br>  6- Validate the condition of the compressor Intake Filter" +

"<br>  7- Validate the condition of the Compressor Cooling Filter" +

"<br>  8- Validate that there is a small amount of air being discharged out the desiccant tube not in use and switches every 30 seconds (see KCS article for testing)" +

"<br>  9- On UL style" +

"<br> \t a. Verify the muffler is not restricting the air flow" +

"<br> \t b. Is there a lot of humidity in the Tube?" +

"<br> 10- Change the Mist Filter" +

"<br> 11- Change the Bulk Water Filter"

  

  

/* HTML */

};

// no return

Things["****DeviceNotifier"].SendMessage(params);

1 ACCEPTED SOLUTION

Accepted Solutions

This is what I did for a work around:

1. Create an app key to use specifically for the service used to send the email and then limit the app key's permissions to only allow it to be used for this

2.  Use this to send emails with the image attatched <img src="https://localhost/Thingworx/MediaEntities/DeviceIcon?appKey=xx1xx76-x8x0-4261-9493-xx1x2dxx50b9" alt="Image" width="75" >

The app key attached to the url essentially is automatically authenticating anyone who receives the email (hence why you want to limit its permissions for only this use)

View solution in original post

5 REPLIES 5
Aanjan
9-Granite
(To:jmay1)

Jenna, you can get to your MediaEntity by going to localhost/Thingworx/MediaEntities/Name_of_your_Entity. I'm not sure if adding a link to a media entity would work (in this use case), because you would need to authenticate into ThingWorx for this entity to be displayed.

jmay1
5-Regular Member
(To:Aanjan)

Is there a way to display a media entity in an email? Because I've tried that url and you're right it is a broken image when sent. Is there a way to achieve this?

Aanjan
9-Granite
(To:jmay1)

Anything that goes through ThingWorx would require you to authenticate. Even if you have an image file in your repository, and then add a link, it will still require you to authenticate. So unfortunately for your email use case, I don't think using a ThingWorx resource would be a viable option. You would probably need to host the image on a different site and then use the external url in your email.

This is what I did for a work around:

1. Create an app key to use specifically for the service used to send the email and then limit the app key's permissions to only allow it to be used for this

2.  Use this to send emails with the image attatched <img src="https://localhost/Thingworx/MediaEntities/DeviceIcon?appKey=xx1xx76-x8x0-4261-9493-xx1x2dxx50b9" alt="Image" width="75" >

The app key attached to the url essentially is automatically authenticating anyone who receives the email (hence why you want to limit its permissions for only this use)

Jenna,


Any update on this? Was Kylie Sauter's post helpful? If so, could you click on the "correct answer" button and let us know?

Top Tags