Display Photo in Email notification from public news/event form

greetings,

we have a public submission form that folks can use to submit news and events. we have a photo upload field and we would like to see the photo in the email notification that is sent out to the editors. i have looked at:

https://support.livewhale.com/_ingredients/templates/details/blurbs.php?id=774&from=%2Flive%2Fblurbs%2F774-customizing-email-notifications

and i do not see any options for adding an image to the email template.

is there a way to display the uploaded image in the notification email?

thanks in advance.

yours,

steve

Hey Steve,

There’s not a way in the core email templates to do this (since we don’t surface the image URL in the out-of-the-box email message variables), but it’s possible with a custom module.

In the public_submission_notification email, the variables that get sent through are

name (Firstname Lastname of who submitted), email, type (event, news, image), title, summary, description, contact_info, event_time (if event), event_time2 (if event) event_date (if event), event_date2 (if event), location (if event), url (if submitted), edit_url

So, probably the most straightforward approach would be something like:

  1. Add a custom module with an onFormatMessageVars handler to process the email variables before sending.
  2. Grab the edit_url variable from the $vars list.
  3. Scrape the id= from the end of that URL to capture the ID of the newly created event.
  4. Use the read() API to get the details for that story/event.
  5. Extract the image URL from that API result and reformat it into an email-friendly <img src="..."/> tag, saving it to a variable in the $vars array
  6. Include that new variable in your public_submission_notification_body.html template.

Hope this helps! This is also something we could help tackle using some personalized email support hours.

excellent. i will have a look and see if i can manage it. otherwise, i will reach out if the communications folks want to proceed it.

thanks!