How to display images in an html email using public url

24.08.22 10:25 PM - By CreatorScripts

Greetings, fellow partners If you need to display images in an HTML email to convey a more professional look. A public URL image that is described in the video below can help. All the scripts required to put it together are also included. Your welcome!

  • Add an Image field (Photo)
  • Upload Photos to the view
  • Publish the view
  • Create a Function "Send" under namespace "Emails"
  • Use an integer parameter to get the record ID
  • Clean the Photo field
  • Incorporate the record ID into the public URL along with the name of the view
  • modify the report type in the URL to image-download
  • in the end, we include the clean filename storing the Photo
  • create a variable "message content" to store the body of the email
  • Now you can add the Send Email function

//Script Function

void Emails.Send(int eid)

{

getEmployee = Employees[ID == input.eid];

//Email Function with Image from within a record

filename = getEmployee.Photo.getsuffix("image/").getprefix("\" border").trim();

customurl = "https://creatorexport.zoho.com/zoho_admin1031/de-constructing-zoho-creator/Employees_Report/" + getEmployee.ID + "/Photo/image-download/GPnD5kAZGK8TGGC69XNjjmMsRyxtdDONOTFORGETTOSMASHTHELIKEBUTTONqFs6OPTQtzhKDebR4H9Xd9WzjSDZCTCxkhBK9wd5nkDjJMJG/" + filename;

messageContent = "<div text-ali"gn: center;\"><b><br><table cellpadding="\"2\"" cellspacing="\"2\"" border="\"0\"" width:" 100%; font-size: 10pt;\"><tbody></tbody></table><img src="\""" + customurl + "\"" + " hei"ght: 100px; width: 100px;\"></style>";

sendmail

[

from :zoho.adminuserid

to :"youremail@zoho.com"

subject :"This is a test email with an HTML Image"

message :"<div>" + replaceAll(messageContent,"null","") + "<br></div><div><br></div><div>Any other email details you need to incorporate bla bla bla....</div>"

]

}

    CreatorScripts