Open Graham-72 opened 7 years ago
No, the module shouldn't set/hardcode the mailsystem. If it does, the user can't control it if needed. Better document it - ref https://www.drupal.org/docs/7/modules/views-send/setup-and-usage
See Drupal issue 2817441 for motivation - in particular my comment at the end.
PS! I might of course be wrong if Backdrop has changed compared to Drupal 7.
@hansfn thank you for your comment. I agree that the user should be able to control the mail system to be used and this should not be hardcoded. In Backdrop the config file system.mail.json is used to determine which mail system class is applied when the backdrop mail system is used and unless views_send has an entry in this file, the default mail system will be used. Now the default mail system may be set to be Mimemail in which case messages from view_send will be sent as Mimemail, but if this is not the case, they can only be sent as text. So it seems to me that views_send should provide a default entry in system.mail.json which can then be changed using the modules 'Mail System' or 'Simple Mail System'.
Furthermore, the system provides for the use of a key that includes a suffix to the module name in the config file, and if the view name is used as this key, the mail system class can be individually selected for each view, again under the administrative control of a module such as Simple Mail System.
However, the main advantage of using the key like this in Backdrop is that each view can have its own template file. I have used this in views_send when creating different subgroups from a membership list so that messages to subgroup A have a different header from those to subgroup B.
So when a view that uses views_send is added to the system we also need an entry added to the system.mail config file that is a key-value pair, with the value being the mail system class e.g. MimeMailSytem and the key has as its first part 'views_send' followed by the machine name of the view e.g. '_email_to_group'.
Much of this is I believe the same as in D7 though I am not sure of the detail. One change I would now like to make to views_send is to have an administrative setting for the default mail system class to be used by views_send, selected from those available in the system. Then this would be added as the initial config setting for each viewssend
I look forward to reading your views on this.
Hi, there. The important thing is to make it user-controlled. Your solution with an administrative setting for the default mail system class for Views Send and using that as the initial config setting for each views, makes a lot of sense.
An added view that uses views_send is not sending mimemail emails. This seems to be a result of the fix for issue #8 which mistakenly removed the internal function _views_send_mailsystem_set().
This function adds an entry to the config file system.mail for each view created in views_send provided a module capable of mimemail is installed, the purpose of the entry being to set the system to use "MimeMailSystem" when handling mail from that view.
Reinstating function _views_send_mailsystem_set() and its use should fix this issue. The function is used twice in views_send.module, just before the Backdrop mail function is called.