CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Simple CiviCRM massmail module
Pages: [1]

Author Topic: Simple CiviCRM massmail module  (Read 5554 times)

greenmachine

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 6
Simple CiviCRM massmail module
March 10, 2008, 07:50:51 pm
Howdy all - I've developed a module that is somewhere between the Drupal simplenews module and CiviMail (much closer to simplenews.module) for a couple of clients and would like to see if there is any interest out there in distributing it.

The module (massmail_civicrm) is somewhat similar to the simplenews module, except it directly scans CiviCRM groups (and checks the DO NOT EMAIL flag) to derive recipient lists. Simplenews, last time I tried it, only allowed periodic, manual import of CiviCRM groups (much hacking involved). That's not good because then clients have to do the importing, and I was running into memory exhaustion with that process (importing the full group at once). My module is also as easy to install as most any Drupal module, rather than the more involved CiviMail process.

My module also provides a form for unsubscription (the user must supply his/her e-mail address which is checked against the contact record for accuracy). Not as secure as an e-mailed unsubscribe token but a malicious user would have to know the conact ID associated with the address (or try a bunch of CID values). Link to the unsubscribe form is included if you add %unsubscribe_link to your template or message.

Multiple HTML or text templates are supported.

No built-in subscription form is included: if you want that you'll have to set up a CiviCRM profile.

It does require the mimemail module, as well as another module I wrote to handle cron-job requests (in this case, # of messages to send per cron job).

massmail_civicrm and sysqueue are here:
http://jkm.idcwebdev.com/files/massmail_civicrm.zip
http://jkm.idcwebdev.com/files/sysqueue.zip

Let me know if you have questions or feedback. Definitely let me know if this would be useful to you or others.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Simple CiviCRM massmail module
March 10, 2008, 10:32:42 pm

hey jesse:

this is pretty cool :) Wanna write a blog post on our civicrm blog about the origins behind this and how you went about doing it. I suspect a few more people will discover it that way :)

thanx for stepping up and doing the needful. I suspect quite a few people who've been daunted by CiviMail will find this module quite useful and relevant :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

matthewpetty

  • Guest
Re: Simple CiviCRM massmail module
March 10, 2008, 10:59:50 pm
YOU DA MAN!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Simple CiviCRM massmail module
March 11, 2008, 12:34:10 am
HI there,

Your install isn't quite right - I changed it to & this works but still get some errors:

Code: [Select]
<?php
function massmail_civicrm_install() {
  switch (
$GLOBALS['db_type']) {
    case 
'mysql':
    case 
'mysqli':
      
db_query("CREATE TABLE {massmail_civicrm}(
mid int(10) NOT NULL auto_increment,
status tinyint(4) NOT NULL default '0',
format varchar(32) NOT NULL,
sender varchar(128) NOT NULL,
subject varchar(128) NOT NULL,
groups text NOT NULL,
template int(9) NOT NULL default '0',
body longtext NOT NULL,
primary key (mid)
) ;"
);

      
db_query("CREATE TABLE {massmail_civicrm_templates} (
id int(9) NOT NULL auto_increment,
title varchar(128) NOT NULL,
code_pre text NOT NULL,
code_post text NOT NULL,
primary key (id)
) ;"
);

    break;
  }
}

function 
massmail_civicrm_uninstall() {
  
db_query('DROP TABLE {massmail_civicrm}');
  
db_query('DROP TABLE {massmail_civicrm_templates}');
}

Remaining errors:

<code>
warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/sites/all/modules/mimemail/mimemail.inc on line 52.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/sites/all/modules/mimemail/mimemail.inc on line 52.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/sites/all/modules/mimemail/mimemail.inc on line 52.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/sites/all/modules/mimemail/mimemail.inc on line 52.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/sites/all/modules/mimemail/mimemail.inc on line 52.

</code>
« Last Edit: March 11, 2008, 12:52:58 am by Eileen »
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Simple CiviCRM massmail module
March 11, 2008, 10:21:07 am
Quote from: Donald Lobo on March 10, 2008, 10:32:42 pm
this is pretty cool :) Wanna write a blog post on our civicrm blog about the origins behind this and how you went about doing it. I suspect a few more people will discover it that way :)

thanx for stepping up and doing the needful. I suspect quite a few people who've been daunted by CiviMail will find this module quite useful and relevant :)

Seconding lobo's comments above!!

You could also add a page describing the module and where to get it etc. on the CiviCRM wiki under this section:
http://wiki.civicrm.org/confluence/display/CRMDOC/Third+Party+Modules
Protect your investment in CiviCRM by  becoming a Member!

matthewpetty

  • Guest
Re: Simple CiviCRM massmail module
March 11, 2008, 10:32:27 am
I wanted to chime in with some more suggestions.

Create a project page at Drupal.org. Assign a version number and get feedback there. Not many people are seeing this forum post.

greenmachine

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 6
Re: Simple CiviCRM massmail module
March 11, 2008, 07:21:40 pm
Thanks for the feedback, folks. I will look into the two bugs raised and then do a writeup and maybe Drupal CVS access request.

The .install problem is no surprise: I haven't tested that part very much at all. The other issue (mimemail related) I think is due to different versions of mimemail. What is the version line at the top of your mimemail.inc? Mine is:

mimemail.inc,v 1.18.2.3 2007/02/26 23:58:44 vauxia

Maybe I have an older version that is different than your's, because there is nothing on line 52 in my copy. The function that is in is mimemail_address(), and it checks for whether the input is an array or not (among other tests) - maybe your version expects a string?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Simple CiviCRM massmail module
March 11, 2008, 11:16:37 pm
I just downloaded it yesterday

$Id: mimemail.inc,v 1.24 2008/02/18 00:43:36 vauxia Exp $

line 52 comes with an ominous message:

Code: [Select]
function mimemail_headers($headers, $from='') {
  // Note: This may not work. The MTA may rewrite the Return-Path, and Errors-To is deprecated.
  if (!$from) {
    $from = variable_get('site_mail', ini_get('sendmail_from'));
  }
  preg_match('/[a-z0-9\-\.]+@{1}[a-z0-9\-\.]+/i', $from, $matches);
  $from_email = $matches[0];
  // allow a mail to overwrite standard headers.
  $headers = array_merge(array('Return-Path' => "<$from_email>", 'Errors-To' => $from, 'From' => $from, 'Content-Type' => 'text/plain; charset=utf-8; format=flowed'), $headers);

However, I had to disable it as I kept getting spam from my site - array@mydomain.com when it was enabled - I presume everytime the error was triggered?

I will try again soon
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Simple CiviCRM massmail module
March 12, 2008, 12:24:49 am
OK   
changing line 724(ish) in massmail_civicrm.module

from

'headers' => mimemail_headers($headers, $sender),

to

'headers' => mimemail_headers($headers, $sender['mail']),

made those errors disappear so I guess that confirms your theory - not sure about the full effect of this.

I still got some blank e-mails on enabling your module but at least they are from the right address this time I guess
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Simple CiviCRM massmail module
March 12, 2008, 12:40:20 am
I'm getting a bunch of 'page cannot be displayed' now though:
- on the main link

?q=admin/user/massmail

 (compose takes me to this first link too)

& on

?q=admin/user/massmail/compose&destination=admin%2Fuser%2Fmassmail%2Fmessages

Some links do work - e.g.
admin/user/massmail/settings
admin/user/massmail/templates
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Simple CiviCRM massmail module

This forum was archived on 2017-11-26.