backdrop-contrib / views_send

Provides mass mailing using Views, enabling a list of email addresses to be produced with a view and an email to the group to be composed and sent.
https://backdropcms.org/project/views_send
GNU General Public License v2.0
1 stars 0 forks source link

Mailsystem dependency error #9

Closed thekenshow closed 8 years ago

thekenshow commented 8 years ago

Installed views_send with mimemail and ran into the following error when trying to send:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=3&op=do_nojs&op=do StatusText: OK ResponseText: ( ! ) Fatal error: Call to undefined function mailsystem_get() in /Users/kendow/Sites/wa.local/modules/contrib/views_send/views_send.module on line 44 Call Stack #TimeMemoryFunctionLocation 10.0025653064{main}( )../index.php:0 20.05283506944menu_execute_active_handler( ???, ???, ??? )../index.php:21 30.05313507848layout_route_handler( ??? )../menu.inc:524 40.05313507848menu_default_route_handler( ??? )../layout.module:405 50.05323577800call_user_func_array:{/Users/kendow/Sites/wa.local/core/includes/menu.inc:576} ( ???, ??? )../menu.inc:576 60.05323578048system_batch_page( )../menu.inc:576 70.05333578048_batch_page( )../system.admin.inc:2276 80.05333579296_batch_do( )../batch.inc:85 90.05333579296_batch_process( )../batch.inc:111 100.05423618472call_user_func_array:{/Users/kendow/Sites/wa.local/core/includes/batch.inc:248} ( ???, ??? )../batch.inc:248 110.05423618520views_send_batch_deliver( ???, ???, ???, ??? )../batch.inc:248 120.05423619688_views_send_prepare_mail( ???, ???, ??? )../views_send.module:1160 130.05433625928_views_send_mailsystem_set( ??? )../views_send.module:1096

Checked and found line 44 of views_send.module:

$mailsystem = mailsystem_get();$mailsystem = mailsystem_get();

So I assume mailsystem should be a dependency?

Graham-72 commented 8 years ago

@thekenshow Yes, this module is work-in-progress and there is an issue with the Mailsystem module ( see https://github.com/backdrop-contrib/mailsystem/issues/7 ) that has caused me problems. I have written a new module called Simple Mailsystem to overcome the difficulty and I am successfully using Views Send, but regretfully I have not yet updated this repo because of other priorities. Are you in immediate need of a working version? If so, I will provide the modification that I am using and update this repo ASAP - something I intend to do in due course.

Thanks for raising this issue.

thekenshow commented 8 years ago

@Graham-72 Thanks for the quick response. I am intending to launch my first Backdrop site (!) this weekend and a working mailing list is part of that. If you can send me whatever you’ve got working, that would be very welcome.

Graham-72 commented 8 years ago

@thekenshow I am delighted to hear you are planning to use this. I will provide a fix here within 24 hours (or 12 if all goes well), or at least update you on the situation.

Graham-72 commented 8 years ago

@thekenshow I have checked through the changes I have made and incorporated them in release 1.1.3 and hopefully you will find this OK. Please let me know how you get on. You will need to install the Mimemail module but not Mailsystem.

When you come to enter the text of your email, remember to set the formatting options to 'Full HTML' and you can then add images in your message. You can also attach files.

I add a template for HTML messages by adding a file 'mimemail-message.tpl.php' in my site's theme templates folder. By editing this template you can add a banner image to your emails. I am intending at some time to modify Views Send so that different templates can be provided for different views - something I want to use on one of my sites.

If you need any help I will be pleased to answer any questions.

thekenshow commented 8 years ago

@Graham-72 Thanks, much appreciated! I’ve installed the latest views_send, disabled and uninstalled mailsystem and run an initial test – all good so far. I’ll be moving to the production server later day and will test further. I created a separate Newsletter editing profile for this, so we’ll see exactly what permissions I need. The toolbar will be needed by the site owner.

thekenshow commented 8 years ago

@Graham-72 I’ve got my client site running on production and can confirm that email can be composed and sent as expected, great!

The mail.css feature works. If I include that file in my theme, it takes over the styles for the messages. If I remove it and configure mimemail to gather the theme styles, that’s what happens.

But I haven’t been able to get mimemail-message.tpl.php to take effect. I tried it in the theme directory and the templates subdirectory, but nothing changes. Do I need to rename that .tpl.php to suggest it to views_send? Or is this a mimemail issue? Thanks.

Graham-72 commented 8 years ago

@thekenshow It's good news that you have got things mostly working. I need to check the template issue. It is working for me with plain file name mimemail-message.tpl.php but maybe there is something slightly different in the version of Mimemail I am using. I will check this and report back, hopefully later today.

Graham-72 commented 8 years ago

@thekenshow I have checked and I am using version 1.1.2 of Mimemail. The only difference I can see is that I have slightly customised the template file so that the code for the body is

` <body id="mimemail-body" <?php if ($module && $key): print 'class="'. $module .'-'. $key .'"'; endif; ?>>

`

This was to provide a banner image to any mimemail email.

This template file is in the templates directory within the site's theme directory, which is within the themes directory.

At other times I have used specific file names such as mimemail-message--views-send--direct.tpl.php and I have checked that this is working too. Just be sure to flush the theme registry when changing these templates.

I hope this helps.

thekenshow commented 8 years ago

@Graham-72 Thanks for checking this. I’m using mimemail 1.1.2 with backdrop 1.42 and a copied & revised version of the bootstrap_lite theme. I’ve altered my local mimemail-message.tpl.php as follows:

`

I AM THE BODY

`

I’ve retested several times using the default .tpl.php name and the specific suggestion you provided, with multiple cache/registry clears, but the original module template remains in effect.

I have other template overrides working in this theme (e.g., maintenance-page.tpl.php), and mimemail is correctly picking up my theme’s CSS files so it’s aware of it. The CSS Compressor is also having no effect.

I tried renaming the original .tpl.php provided in modules/contrib/mimemail and clearing the cache. That generated errors when trying to send and didn’t pick up my local template.

Graham-72 commented 8 years ago

@thekenshow I have just used your alteration to the template file in my system and my test email arrives with the line I AM THE BODY so I know that the template is being used in my installation.

The difference between us would seem to be the theme, and perhaps the layout. My recent tests have been with the protype Basis theme and the two column layout. I have also used it with Bartik. Are you able to change to Bartik easily, just for a test? I have never used the Bootstrap_lite theme but could apply that to a test site here.

Graham-72 commented 8 years ago

@thekenshow I have now installed Bootstrap_lite and copied the file mimemail-message.tpl.php into the bootstrap_lyte directory, and it works fine, and I can see that this template file is modifying the message content.

Are you getting this to happen on your site? If not, what are you seeing? Are yu getting any emails sent and delivered?

thekenshow commented 8 years ago

Hi Graham - the production server is sending email as expected, and they’re being styled with the CSS from my theme. I can’t convince my local MAMP Pro dev setup to send email, so I’m going to have to create a staging server to test further. Thanks again for all your effort on this. Based on your testing, it’s beginning to look like my modified version of backdrop_lite is somehow the issue. I’ll respond here as soon as my staging site is up and running.

thekenshow commented 8 years ago

OK, set up a staging site, switched to the bootstrap_lite theme and dropped in templates/mimemail-message.tpl.php. Cache cleared++, sent message, no difference - still ignores template.

Finally figured it out: if the list of users view is assigned to an admin location (e.g., admin/people/my-news/) then views_send/mimemail picks up on the admin theme for templates, not the default theme. It does pick up on the presence of mail.css in the default theme, so that’s what threw me off. When I moved my view to /my-news, the template took effect.

I would expect the default theme to be respected no matter what, but failing that at least consistent handling of .tpl.php and mail.css would be good...!

Graham-72 commented 8 years ago

@thekenshow Thanks for figuring out what was happening. This is clearly something that needs to be fixed, but perhaps not until I modify views_send so that the view name links to a specific template file - issue #7

Graham-72 commented 8 years ago

@thekenshow I have raised an issue in Mimemail to address this problem with the theme.

Would you be happy to close this issue here and deal with it there?

thekenshow commented 8 years ago

@Graham-72 - yes, thanks for following up.