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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
Pages: [1]

Author Topic: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?  (Read 1062 times)

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 01, 2011, 11:10:54 pm
Hi,

The behaviour I'm seeing is that the opt-out flag is looked at when the mailing is created rather than when it is sent.  This means that if I schedule two mailings at some time apart and after the first one the contact opts out, then the second mailing will still send out an email to the opt out contact.  Is there a way around this or is this as designed?

Regards,
Malks.

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 01, 2011, 11:28:22 pm
I found the thread at http://forum.civicrm.org/index.php/topic,16594.0.html that suggests that it is done at sending out but testing seems to suggest that this is not the case.  Could this have changed in a version upgrade?

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: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 02, 2011, 06:08:49 am

Its currently as designed :(

we could potentially to do a final check just before we send out the email to ensure that this contact has not opted out. You could retrieve the

the code is here:

CRM/Mailing/BAO/Job.php, function deliverGroup

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

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 02, 2011, 04:13:01 pm
Hi lobo,

Would this be something I could supply a patch for?  I'm not really up with the whole patch process but happy to jump in.

Regards.

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: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 03, 2011, 07:22:54 am

Yes, that would be great. You should utilize the existing queries so we dont introduce a new query in the loop

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

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 03, 2011, 07:13:29 pm
Hi Lobo,

Looking at CRM/Mailing/BAO/Job.php I thought a better place to put it is the query at the start of the deliver() function.  Namely, change the query below to join on the contact table and add to the condition where is_opt_out = 0.  Does that make sense?  How do I go about pushing a patch?

Malks.

Code: [Select]
        $query = "  SELECT      $eqTable.id,
                                $emailTable.email as email,
                                $eqTable.contact_id,
                                $eqTable.hash
                    FROM        $eqTable
                    INNER JOIN  $emailTable
                            ON  $eqTable.email_id = $emailTable.id
                    LEFT JOIN   $edTable
                            ON  $eqTable.id = $edTable.event_queue_id
                    LEFT JOIN   $ebTable
                            ON  $eqTable.id = $ebTable.event_queue_id
                    WHERE       $eqTable.job_id = " . $this->id . "
                        AND     $edTable.id IS null
                        AND     $ebTable.id IS null";

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 04, 2011, 08:46:22 pm
So I've created a patch that seems to do what is required... what do I do with it now?

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: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 05, 2011, 09:24:44 am

can u file an issue at http://issues.civicrm.org/

and attach the patch there. we'll apply it for the 4.1 release

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

malks

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
  • CiviCRM version: 3.4.x 4.x
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.x
  • PHP version: 5.3.x
Re: Emails sent out to opt-out users if mailing scheduled before opt-out occurs?
September 05, 2011, 07:14:50 pm
Done :)

http://issues.civicrm.org/jira/browse/CRM-8811

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Emails sent out to opt-out users if mailing scheduled before opt-out occurs?

This forum was archived on 2017-11-26.