Can I use html tags in method directive for email

I want the email to look more presentable in method directive, is that possible?
the tags doesn’t seem to work.
image

Try encapsulating your message in the required tags needed for HTML.

1 Like

My guess is that widget doesnt support HTML email. I dont know that to be true, just a hunch

Widget in Kinetic UI supports HTML if it was created in Kinetic initially.

@Olga can I send email using a widget? if yes, what’s the name of the widget?
Thanks.

we are talking here about email widget in BPM.
So in Kinetic BPM designer name is something like Send Email, and it is supposed to send emails in BPMs.

To get around some of the limitations of the BPM Email widget, I created an Epicor Function to send notification emails. It uses Epicor’s Ice.Mail.SmtpMail class, and supports HTML formatting in the body.

Note that the ‘notificationSettings’ variable from the UD10 table is something that I use in our system. UD10 stores custom system settings. You would need to replace this to fit your needs.

Function Parameters

  • AddressFrom (string)
  • AddressTo (string)
  • AddressCC (string)
  • AddressBCC (string)
  • AddressReplyTo (string)
  • Subject (string)
  • Body (string)
  • Priority (int)

Function Code

try
{
  var notificationSettings = Db.UD10.FirstOrDefault(row => row.Company == callContextClient.CurrentCompany && row.Key1 == "NOTIFICATION" && row.Key2 == "GLOBAL");

  if (string.IsNullOrWhiteSpace(AddressFrom))
  {
    AddressFrom = notificationSettings.Character05;
  }
  
  var subjectPrefix = notificationSettings.Character08;
  if (!string.IsNullOrWhiteSpace(subjectPrefix))
  {
    Subject = subjectPrefix + " " + Subject;
  }
  
  var bodyPrefix = notificationSettings.Character09;
  if (!string.IsNullOrWhiteSpace(bodyPrefix))
  {
    Body = bodyPrefix + "<br><br>" + Body;
  }
  
  var mailer = this.GetMailer(async:true);
  var message = new Ice.Mail.SmtpMail();
  
  message.SetFrom(AddressFrom);
  message.SetTo(AddressTo);
  message.SetCC(AddressCC);
  message.SetBcc(AddressBCC);
  message.SetReplyTo(AddressReplyTo);
  message.SetSubject(Subject);
  message.SetBody(Body);
  message.Priority = (System.Net.Mail.MailPriority)Priority;
  
  message.IsBodyHtml = true;
  mailer.Send(message);
}
catch(Exception ex)
{
  Ice.Diagnostics.Log.WriteEntry($"An error occurred while attempting to send notification email. Exception: {ex.Message}");
}
3 Likes

this worked out for me:

DMR number:

Part Number: Revision Number:

Description:

Comments:

A word of caution when using fields in your HTML based email, you should escape certain characters so they don’t accidentally alter the HTML code.

Replace ‘<’ with ‘&lt;’, ‘>’ with ‘&gt;’

And probably should escape the ampersand, single and double quotes too. Do the ampersand first, else you’d fubar the others.

2 Likes