cPanel Notification email - plain text

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
Is there a way to configure the notifications that cPanel send (such as when the contact email is updated) so tht they are sent plain text. HTML is NOT for email it is for web sites. I do not mind the HTML so much as the incorrectly formatetd (encoded?) content. Notice how the quotes are incorrectly displaeyd in the email snippet below...



Your primary email address changed from “[email protected]†to “[email protected]â€.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,263
313
Houston
I just checked this and I don't see an issue with the formatting of these - it's encoded so the email address looks different when viewed in non-html:

Your notification settings have changed.

The system saved an update of notification settings for your account:

Your primary email address changed from =E2=80=9C=E2=80=9D to =E2=80=[email protected]=E2=80=9D.
The HTML is as follows for that portion:
Code:
    <p>
                    Your primary email address changed from =E2=80=9C=E2=80=
=9D to [email protected]=E2=80=9D.
            </p>
When viewed via HTML it looks as follows:

Your primary email address changed from “[email protected]” to “[email protected]”.

But alas there's no way to change the type of email to plain-text
 

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
Drat. I use an OOOOOOOLLLLDDDDDD email client (Eudora 7.x). I am limited to that because it is a very clean plain interface and my reading disbailities dictate that I use something like this. (Notice I have a lot of typos and transposition in posts, reading issues.) Even when I use the built in option "Use Microsoft's Viewer", the mail renders as HTML but becasue of the encoding utilized it is still scrogged. See pic.

example.JPG
 

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
PLEASE consider going to plain text for any notification email. HTML is NOT for email, it is for web pages! Just because you CAN do something does not mean you SHOULD do it. :) Additionally, whereas it coudl be argued that HTML in email makes it look cool, making something look cool is rarely if ever a good reason for taking an action.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,263
313
Houston
Yea, my assumption is the transfer isn't recognizing everything - unfortunately, I highly doubt the method which these are sent will be changed. Most email for that matter is sent using HTML these days and I'd disagree it's just for websites, I don't know about looking cool but it does allow some options for readability, branding and uniformity that plain text doesn't offer. You're welcome to open a feature request for it though.
 

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
I guess I will have to do that. I respectfully disagree about the HTML email thing. There is precious little that cannot be expressed in words that using prettied up HTML can do. I also highly disagree that MOST email is sent that way. Perhaps most might offer that option, but it is much less readable in many cases (see above) and branding simply means embedding advertising in email that should not be there in the first place. The primary fucntion of email is to transmit useful information. If the method employed to send that information impairs the ability to present that information in a readable manner it prima facia by default should never be used. VERY bad choice to send email that cannot be read.

Will you please point me to where in the code these emails are generated so perhaps I can write my own procedures to have them sent so that they can actually be read?
 

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
Not a problem at all. I am goiong to start digging through the documentation and the templates to see how they are used to create the actual email. Today I am updating a number of sites with client featuire requests. Just took a break to snack on soem angle food cake. Yummy!
 
  • Like
Reactions: cPanelLauren

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
OK I found the offending code and it EXACTLY what I thought it as going to be. AN example is in the template for contact info change. The template uses curly quotes --> “ <-- instead of plain generic text quotes --> " <--. This happens frequently if a template is designed (for example) in MS Word or dome other non-plain text editor. It would be HIGHLY recommend that the templates be saved as plain test to avoid this issue. If that were to be done, the HTML would be a non-issue.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,263
313
Houston
But that HTML issue is only present on older clients it looks like - This whole thing seems to me to be a feature request @PCZero - Maybe something like Provide the option for plain-text icontact notifications
 

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
True it may be only an older client issue, however changing to plain quotes instead of curly quotes impacts 'newer' clients in no manner. So why have the curly quotes if it adds nothing and in fact deters the ability of some clients to use the notifications? :)

I --> THINK <-- I have an easy fix.

1) Clone the entire /usr/local/cpanel/etc/icontact_templates/ directory structure to /var/cpanel/templates/icontact_templates/ (See Notification Templates | cPanel & WHM Documentation)

2) Run these commands to replace all instance of the open curely quote and then the clsoe curly quote with plain text double quotes.
grep -riIl '“' | xargs sed -i 's/“/"/g'
grep -riIl '”' | xargs sed -i 's/”/"/g'


That is it!

There may be other characters that need to be replaced. If I find any I will update this thread. Comments on the validity of my solution (even if they prove that my solution is highly flawed) are welcome.
 
Last edited:
  • Like
Reactions: cPanelLauren

PCZero

Well-Known Member
Dec 13, 2003
712
85
178
Earth
OK I am stumped. The documentation at Notification Templates | cPanel & WHM Documentation states the each template can have two versions a noticifcation . html . tmpl and a notification . text . tmpl. HOWEVER it never states how one goes about telling the system to use the text version instead of the html version!

I cloned the templates over to the appropriate directory to set up custom templates, cloned the *.html.* to *.text.* for the contact info change template, then edited each, adding "TEXT" to the end of the *.text.* file's content and "HTML" to the to the end of the *.html.* file's content. I then chanegd the contact info for an account and the notification I received was the HTML version.

How do I indicate that i want to use the text verisons of my custom notifications?