#1: Use MaildropHost for sending mails
- Contents
MaildropHost offer asynchronous mail sending functionality, which was removed from SMH.
- Proposed by
- Radim Novotny
- Seconded by
- Christian Heimes
- Proposal type
- Architecture
- State
- being-discussed
Definitions
SMH - SecureMailHost
MDH - MailDropHost
MH - MailHost
Motivation
Asynchronous mail sending is very useful feature. It may speed-up server response when mail server does not respond immediatelly or when Plone server is sending large number of mails (for example newsletters). Async mail sending was removed from SHM itself because was too experimental. MaildropHost is intended to be used in this case.
Proposal
Modify current SMH implementation to use MaildropHost if available.
Add TTW configuration checkbox: "Use MaildropHost service" This checkbox will be available only when MDH is available, of course, set to True by default. Another option is leave this configuration in config.py only (automatically decide whether use MDH or not).
Modify Plone prefs_mailhost_form template appropriatelly (add "Use MaildropHost service" checkbox). See Risks section for details.
Suppose large Zope installation with one Zope admin and several Plone sites. Each Plone site has own Plone site manager.
Zope admin may
- want to use MDH everytime (not to allow Plone site admins to modify settings) or
- allow to modify this setings (use MDH or not) by Plone site managers
ad 1) this option must be defined in SMH/config.py by the Zope admin. We need to add this option and use it where needed.
ad 2) this option needs new checkbox in the ZMI and Plone interface - "Use MaildropHost" and Plone admin may switch using MDH on/off. If MDH is set to "on", Plone admin can't edit MDH SMTP settings TTW (MDH is using own sitewide configuration file). If MDH is set to "off", Plone site admin may change SMH settings as usual. Please see Risks section too.
Implementation
Modify current SMH implementation (do not alter existing code, add USE_MAILDROPHOST variable and do new functions only when this is set to True).
Risks
There may be problem in the Plone setup UI, because user inserts mail server, port, username and password and these values are not used (MaildropHost has own config.py module). MaildropHost does not allow TTW configuration.
Solution: we should declare new public method of SecureMailHost class (something like isMaildropHostUsed) which may be used in the prefs_mailhost_form template to inform site manager, that MaildropHost configuration is used for sending mail (and config.py for settings). We can add "Use MaildropHost service" checkbox to the Plone UI too (this will need another msgid to the translation catalog). How to hide SMH SMTP settings when users selects "Use MaildropHost service" in this case ?
Another risk may be using old MailHost as backend for e-mail generator. Proposed implementation would pass e-mail message generated by the SMH to the MDH (and MH) including all headers. MH is munging some headers. It'd be nice to have something like send_plain function in MH (to send message text including headers AS IS to SMTP server).

Because of Plone's change to SecureMailHost which has a slightly different send call (message instead of messageText) and that MailDrophost extends MailHost we found we needed to make some changes.
The easy solve was to make MailDrophost extend SecureMailHost.
Just something to be aware of when implementing this proposal. Also let me know if/when this goes ahead as I would be happy to help out.