[OPENDJ-1985] SMTP Handler sends only text/plain emails Created: 29/Apr/15  Updated: 08/Nov/19  Resolved: 20/Nov/15

Status: Done
Project: OpenDJ
Component/s: None
Affects Version/s: 2.6.2
Fix Version/s: 3.0.0

Type: Improvement Priority: Minor
Reporter: Matt Miller [X] (Inactive) Assignee: Ludovic Poitou
Resolution: Fixed Votes: 1
Labels: release-notes

Attachments: Java Source File EMailMessage.java     Java Source File SMTPAccountStatusNotificationHandler.java     HTML File html-email-patch-copyright     HTML File html-email-patch2     Text File html-email.patch    
Dev Assignee: Ludovic Poitou
Support Ticket IDs:

 Description   

The "SMTP Handler" Account Status Notification Handler only sends text email. It is desired to change this to enable sending HTML email.

Sending HTML Content-Type'd email with the base text templates looks fine, even though a configuration item seems cleaner - as long as HTML type can be sent this would complete the request.

Attached is a changed SMTPAccountStatusNotificationHandler and EmailMessage as a proposed means of accomplishing this task, as an example of how it might be possible to get the handler to send HTML email – the diff between these java files and 2.6.2 source is very tiny.



 Comments   
Comment by Ludovic Poitou [ 29/Apr/15 ]

Yes, it is on purpose that it only send plain text emails. These are easier to parse by machines than html mails, and they result in smaller messages.

I can understand that specific emails could be preferred to be sent in HTML, but I would like to leave the choice to the administrator. Can that be done on per type of email ?

This said, I would prefer any contribution or suggested contribution to be provided in the form of patch with the appropriate copyright statements and compliance with checkstyle.

Comment by Idzerda Edan [ 29/Apr/15 ]

Thanks for your comments. For us, we want to send these emails to end users (ie, customers), and we want the emails to follow our corporate style guidelines. Changing the Content-Type to text/html from text/plain and sending the default plain text messages doesn't add any overhead to the messages, and it looks fine IMHO when viewed in Outlook, so I don't personally think it would be such a bad thing to default to text/html.

I thought that perhaps a configurable option for all emails might make sense. It could default to text/html (or text/plain), but then the administrator can override it. Like I said, I don't see a downside to default to text/html.

I'll re-attach my suggested implementation as a patch and try to match your code style better. I'll talk to my manager about the copyright statements, but it shouldn't be a big deal.

Comment by Ludovic Poitou [ 29/Apr/15 ]

Hi Ezra,

First I had not realized this was a customer sponsored contribution. Thanks.
In my working experience, I've involved with mail and messaging servers... And interoperability. Hence the sensitivity to not sending everything in html format.

This said the requirement is fully understandable. And with a simple configuration switch, can be easily integrated in coming releases of the product.

Comment by Idzerda Edan [ 29/Apr/15 ]

Patch for HTML email based on 2.6.2 source.

Comment by Idzerda Edan [ 30/Apr/15 ]

Thanks a lot, Ludo. I took a look at adding a configuration option and got that working in my local build. I tested with the option on or off, as well as dynamically updating it on the fly. The only thing that doesn't seem to work is seeing the new property (ds-cfg-send-email-as-html) from inside dsconfig. I updated cn=config via LDAP and it picked up the changes fine.

I realize you may want to change variable names and perhaps the whole approach, but I wanted to provide a working example to help push the process along. Let me know if there's anything else I can do to help. OpenDJ is definitely my favorite LDAP server, and I have worked with several since Netscape

Comment by Idzerda Edan [ 30/Apr/15 ]

Patch with updates for configurable option (sendEmailAsHtml) and updates to config.ldif and schema/02-config.ldif

Comment by Ludovic Poitou [ 21/Oct/15 ]

Hi Edan,
I'm going through issues that are pending.
As we're winding down the development to do the release of OpenDJ 3.0, I'm trying to assess whether this can be integrated or not.
Any update with regards to the copyright statement ? I think this is the remaining road block to integration.
Feel free to contact me directly, if you feel more comfortable doing so.
Regards,
Ludovic.

Comment by Idzerda Edan [ 26/Oct/15 ]

Hi Ludo! I checked with my management and we are fine releasing the code under whatever copyright you need--I assume CDDL. Do you need me to reupload the patch with the copyright or is this comment sufficient?

Comment by Ludovic Poitou [ 26/Oct/15 ]

Hi Edan,

CDDL is the license.
Copyright represents the author of the code changes. We are fine if you agree to assign the copyright to ForgeRock, or if you prefer to have the code changes under the copyright of you or your company. Please let me know which one will work for you.

Comment by Idzerda Edan [ 27/Oct/15 ]

Patch with copyright statements

Comment by Idzerda Edan [ 27/Oct/15 ]

Either is fine with me, really. I uploaded the patch with Portions copyright in my name because it seemed fun.

Thanks for including my tiny patch in such a great product.

Comment by Ludovic Poitou [ 20/Nov/15 ]

Thanks Edan for the contribution

Comment by Peter Major [X] (Inactive) [ 19/Jan/16 ]

Mark Craig, will this be also mentioned in the Admin Guide in the future? I could only find references to this feature in the release notes.

Comment by Mark Craig [ 19/Jan/16 ]

Peter Major [X], it's true that this is only covered in the reference and release notes right now.

I've opened OPENDJ-2632 to cover it in the Admin Guide section on account status notification.

Comment by Matthew Swift [ 07/Nov/19 ]

Moved to closed state because the fixVersion has already been released.

Generated at Tue Jul 07 23:24:35 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.