HTML header / footer template
Is it possible to put HTML header to allow inserting images ?
Thanks
--
Asaf Ohayon
On 05/06/2018 05:31 AM, Asaf Ohayon wrote:
Is it possible to put HTML header to allow inserting images ?
No.
message and digest footers and headers are always added either to a MIME text/plain message body or as separate MIME text/plain parts. HTML tags will just be displayed as plain text and will not be rendered as HTML.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Is there a reason not to enable HTML content? Is there any other way to put images in header / footer template ?
Thanks
I understand Mailman 3 doesn't want to support HTML Emails, This is perfectly legitimate, sadly however, This is a requirement of my client, Which is in this case the Ministry of Education of Israel.
This is not the first time a client of mine requires this, This is also was required and implemented in Mailman 2 couple of years ago by some other client (big college).
So starting to implement it, I found this article: https://blog.hubspot.com/marketing/plain-text-vs-html-emails-data
which also claims that HTML Emails is prefered by many users (although I understand the problematic nature of HTML Emails)
Could You give me some directions on how to go about implementing this ?
Thanks
On 06/18/2018 02:33 AM, Asaf Ohayon wrote:
I understand Mailman 3 doesn't want to support HTML Emails, This is perfectly legitimate, sadly however, This is a requirement of my client, Which is in this case the Ministry of Education of Israel.
Mailman does support HTML email. Just adjust content filtering to not remove HTML and not collapse alternatives.
What Mailman does not support (and which I think is what you want) is the addition of headers and footers either as text/html parts or inserted into text/html message bodies.
The former would be fairly easy. Look at mailman/handlers/decorate.py. If the messages you are decorating are text/html or multipart/alternative or something more complex, the header and footer are going to be separate MIME parts anyway, so where we have
if len(footer) > 0: mimeftr = MIMEText( footer.encode(lcset, errors='replace'), 'plain', lcset) mimeftr['Content-Disposition'] = 'inline' payload.append(mimeftr) if len(header) > 0: mimehdr = MIMEText( header.encode(lcset, errors='replace'), 'plain', lcset) mimehdr['Content-Disposition'] = 'inline' payload.insert(0, mimehdr)
in two different places, just change the 'plain' arguments to 'html' and then the headers and footers will be added as text/html and can include html tags to be rendered.
On the other hand, if what you want is to insert headers and footers at the beginning and end of an existing HTML body part, We will not make Mailman do that because it is very difficult to do it right. This is because just prepending or appending some additional HTML to an existing HTML part gives unpredictable results. You need to actually parse or render the existing HTML to determine how to add your additions and in complex cases even that may not render as you wish in all various MUA renderings.
If you want to try for HTML what decorate does for simple plain text, you can try it and you may find it works for you, but it is way to fragile for a Mailman feature.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Asaf Ohayon
-
Mark Sapiro