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) »
  • Sending duplicate emails
Pages: 1 [2]

Author Topic: Sending duplicate emails  (Read 8725 times)

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Sending duplicate emails
May 10, 2011, 07:26:19 am
Thanks, Piotr!

As far as checking whether it shouldn't be DISTINCT or not, I haven't the vaguest idea - I got a request from a client to eliminate duplicate mailings to the same email address and the original patch seemed to do the trick.

When you ask about "adding the email column," I don't know what you mean - I just patched the file and the problem went away; I didn't go any further... hey, if it works... ;-)

They seem to be doing OK for the moment in 3.3.5, but if I upgrade to 3.4, they'll definitely want the same functionality. They're sending out emails like crazy, so I guess I'll wait to hear back from you or someone else who can try it out before I risk fixing something that ain't broke!

Thanks, Piotr... I'll keep an eye on this!

Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Sending duplicate emails
May 13, 2011, 03:29:18 am
Quote from: bcobin on May 10, 2011, 07:26:19 am
As far as checking whether it shouldn't be DISTINCT or not, I haven't the vaguest idea - I got a request from a client to eliminate duplicate mailings to the same email address and the original patch seemed to do the trick.

I looked at the patched SQL and it seems to be ok without the DISTINCT clause. :)

Quote
When you ask about "adding the email column," I don't know what you mean - I just patched the file and the problem went away; I didn't go any further... hey, if it works... ;-)

:) Sure thing. This patch adds an email column to the virtual/in-memory/temporary tables used to construct a recipient list for a given mailing and makes sure the mailing is not sent twice to any given email address (even if it’s shared by different contacts).

Quote
They seem to be doing OK for the moment in 3.3.5, but if I upgrade to 3.4, they'll definitely want the same functionality. They're sending out emails like crazy, so I guess I'll wait to hear back from you or someone else who can try it out before I risk fixing something that ain't broke!

You’ll want to upgrade eventually, as we also fixed another issue that might be biting you (also probably the cause of your earlier issues).
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Sending duplicate emails
May 13, 2011, 05:17:37 am
Coooool! I'll probably upgrade them sometime over the weekend, then.

Thanks, Peter - you're the best!

-b,

(note the comma at the end...)  :)

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Sending duplicate emails
May 13, 2011, 06:40:28 am
I have a patch by basically applying the "GROUP BY"

in the query that constructs all the mailing recipients, it basically goes to find the first contact with the same email and not to send to the rest of (dupes).

It's for 3.3.2 and I have tested and verified it works.


Cheers!

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: Sending duplicate emails
May 28, 2011, 06:02:45 pm
Looks like that works.  Thanks Piotr!

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Sending duplicate emails
October 27, 2011, 01:10:01 pm
FYI --
the option to dedupe by email will be included in v4.1

http://issues.civicrm.org/jira/browse/CRM-3975
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Sending duplicate emails
October 27, 2011, 02:18:32 pm
Is the patch from #18 still the best option for those on 3.x? Thanks much for the work here - glad to see it will be implemented!

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Sending duplicate emails
October 27, 2011, 02:29:15 pm
i basically used that solution (group by) in the patch. but the patch adds a field to the interface so the deduping is optional.
since deduping on email impacts your use of contact-specific tokens, we can't assume people will want it used all the time.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Sending duplicate emails
October 27, 2011, 02:50:21 pm
actually -- we just realized it doesn't dedupe against the combined list if you're using groups + past mailings. we're restructuring and will have a commit patch in a few min.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Sending duplicate emails
November 05, 2011, 10:40:42 am
Thanks for the work here - I see this has been done for 4.1, but I'm still using Drupal 6 and Civi 3.x on all my sites.

To be clear, which patch should I use for 3.4.7? Thanks much!

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Sending duplicate emails
November 05, 2011, 06:22:14 pm
use the actual commits to core, not the original patch files. we changed some stuff after the patch files were committed.

the code will work on 3.4 -- i'm running it there right now. but you may need to manually apply the patches.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Sending duplicate emails
November 08, 2011, 05:42:11 pm
Thanks, @lcdweb - this is terrific. I'm not a developer and I'd just like to be sure - I'll be installing this on a live site that uses CiviMail a lot:

From http://issues.civicrm.org/jira/browse/CRM-3975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

From 37056,

trunk/templates/CRM/Mailing/Form/Group.hlp
trunk/templates/CRM/Mailing/Form/Group.tpl
trunk/CRM/Mailing/Form/Group.php

should replace the existing files.

trunk/CRM/Mailing/BAO/Mailing.php should be taken from #37312

dedupe_emails.patch should be applied, and then
dedupeemail2.patch should be applied.

Is that right?

I don't see where trunk/xml/schema/Mailing/Mailing.xml (from 37056) should go and I don't know what to do with dedupe_email.sql.

Sorry to be dense - please forgive and allow me to express my appreciation for all the work you and Lobo have done here. The organization is dealing with purchased lists that have a lot of duplicate email addresses for people in the same household, so this is a real lifesaver. Thank you!

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Sending duplicate emails
November 08, 2011, 05:56:52 pm
you don't need to apply the .patch files. they are covered by the "real" patches on trunk (37056 and 37132).

the sql statement needs to be run against your db. we add a field to the mailing table (and you should make a note of that -- you'll need to comment that out of the upgrade script for the 4.1 release, as your db will already have the value)

the xml file is used to generate the table schema and DAO files. so it doesn't exist in the install package. but you will need to modify the corresponding DAO file.

go to: CRM/Mailing/DAO/Mailing.php
you'll see that each field in the _mailing table has a corresponding array element where its attributes are defined. you should be able to just replicate by eye what the new element will be -- refer to how the field is created in the sql file.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Sending duplicate emails
May 31, 2012, 12:39:06 pm
Confirmed, this patch works on 3.4 (latest svn).

 - Alan

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Sending duplicate emails

This forum was archived on 2017-11-26.