Make text in 'RED' color in mail scripts for inbound email actions

Rocky5
Kilo Sage

Hello Experts,

 

For inbound actions, I am using mail script where I have the below line of code. And It shows as below screenshot when 'Reject' button is clicked on the notification.

Mailscript: 

 

 template.print('<a href="mailto:' + emailAddress + '@service-now.com?subject=RE: Rejected: ' + current.number + '&body=Click send on this email to save your selection in ServiceNow and Reject this Idea.%0d%0aProvide any comments below to be included in the Rejection Comments on the record:%0d%0a%0d%0a[ Insert Rejection Comments Here ]%0d%0a%0d%0a%0d%0a' + email.watermark + '">Reject</a>');

screenshot:

Rocky5_0-1702322764399.png

But, We want "[Insert Rejection Comments Here]" to be in RED color. what should be the modification in my line of code?

 

Thanks.

Rocky.

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, have you tried using style="color:red" in your href link? or css?

Hi Tony,

 

I need 'RED' color only to the highlighted part in my screenshot i.e. this part [Insert Rejection Comments Here].

Can you please provide me the full line of code with modification that you want me to try on my machine?

Thanks,

Rocky.

Muhammad Hamza
Kilo Sage

Hey @Rocky5

You can add a Span tag and &Content-Type=text/html to the URL.

 

 <a href="mailto:' + emailAddress + '@service-now.com?subject=RE: Rejected: ' + current.number + '&Content-Type=text/html&body=Click send on this email to save your selection in ServiceNow and Reject this Idea.%0d%0aProvide any comments below to be included in the Rejection Comments on the record:%0d%0a%0d%0a<span style='color:red'>[ Insert Rejection Comments Here ]</span>%0d%0a%0d%0a%0d%0a' + email.watermark + '">Reject</a>;

 

However, it didn't work for me on the Outlook. It may work on previous versions and may not work on other email clients.

According to the Mailto specification, you can add whatever arbitrary headers you want to your mailto link. This means you could add &Content-Type=text/html to the URL to indicate it's an HTML message, in which case it should parse your HTML and CSS like a normal HTML email.

However, the spec also states that the only headers that should be relied upon are the subject and body headers.

The creator of a mailto URL cannot expect the resolver of a URL to understand more than the "subject" and "body" headers. Clients that resolve mailto URLs into mail messages should be able to correctly create RFC 822-compliant mail messages using the "subject" and "body" headers.

In other words, you can try it but don't expect it to work for everyone. If this is for public use, just forget about it, and stick to plaintext.

More on it here.

 

Regards,

Hamza