Send campaign to overlapping emails of two lists

I can send an email to several lists, and I can also exclude lists but I was wondering if I can send an email to only the people who overlap in two lists ?
For instance to lists: “2.x_version_users” AND “registered_users” ?
There is no “not_registered_users” list that I could use to exclude sending to.
How would you go about this ?

1 Like

I haven’t seen anything in the web interface that would allow you to do this, but you could

  1. Using a query in the database, create a new list and add only those that are on the two other lists
    or
  2. Export list 1 and list 2, using an external script, surpress any email address that does not appear twice, and then import the result to the new list.
1 Like

I’d dig a rule system, like “send to list A and B and not C”.

1 Like

The use of AND OR and NOT would be a great addition indeed !

That said, does anybody know where in the code exactly I can HACK the code to use AND instead of the hard coded OR between lists to send to ? I image though that it won’t be as simple as that ?

You might want to consider using attributes instead of separate lists.

If “2.x_version_user” was an attribute then you could send the campaign to subscribers of the registered users list who also have that attribute set, using the Segmentation plugin.

I actually have an attribute that I can use for that !

Do tell … I wasn’t aware there are plugins, let alone a plugin that can do this ?
Where can I find it and will it work with my slightly older version ( 3.0.12 ) ? (I’d rather no update to the latest and greatest at the moment, since I just released a new version of my software and I’m sending out emails as we speak).

See https://resources.phplist.com/plugins/start

I think that the Segment plugin will work with an old version of phplist, but does require php 5.4 or later.

1 Like

Thanks Duncan !

I installed SegmentPlugin, as well as the CommonPlugin, manually per the instructions.
Both show up when I go to ‘Manage Plugins’

Unfortunately the described ‘Segment’ tab is not showing on the ‘Send a campaign’ page.

Any ideas ?

@ibPeter Have you enabled the plugins?
If Common Plugin is enabled then there should be some extra items on the Config menu - phpinfo, config.php and session, are they displayed?

1 Like

AH … that’s it ! I didn’t realize I had to enable them as well, which I just did by clicking the thumb-down icons above both common- and segment-plugin, on the ‘Manage Plugins’ page.

There is a Segment tab now !

Thanks, I’ll go to work with that.

Looking great !!!

So just to make sure before I start sending …

The email will be sent to people on the several lists I defined except the people who are also on one of the exclude lists and of those matched via the lists only the people who match the segment criteria will get the email … correct ?

Match = (List_1 || List_2 || List3) && !(List_4 || List_5) && Segment

Yes, that should be the case. phplist does its usual processing of confirmed, not blacklisted, and not on any excluded lists. Only then is the plugin asked for each subscriber whether to allow sending to him.

But you should calculate the number of subscribers and do a reasonableness check on that figure.

Thanks Duncan,

I was just doing that (the calculating) and it seems to work.

One issue … why is value 0 not accepted ?
I have a field that (besides being empty) may also contain 0, 1, 2 or 3
When I enter the value 0, calculating says ‘one of the conditions has an invalid target value’

Ah, that looks to be a bug. I assume it is a text field, and a value of 0 is not handled correctly. If you need that to work then you can make a local change

file plugins/SegmentPlugin/AttributeConditionText.php

line 56 is

 if ($operator != SegmentPlugin_Operator::BLANK && $operator != SegmentPlugin_Operator::NOTBLANK && !$value) {

change that to

 if ($operator != SegmentPlugin_Operator::BLANK && $operator != SegmentPlugin_Operator::NOTBLANK && $value === '') {

It’s untested but should solve the problem.

Thanks Duncan,

Indeed a Text field and correct, changing that line fixes it !

I can work with this now. Thanks again.

Perhaps another suggestion Duncan.

Maybe you can also allow the ‘Calculate’ button to work when simply no selection has been made on the Segment tab.
It’s a nice gadget/tool then to see the net result of all the selected lists, the blocked lists, impact of blacklisted emails etc.

Now, when I try it, it returns 0 when I don’t make a selection on the Segment tab

Oops … the email was sent to no one … it seems I have to set some sort of segment for it to work ?
Calculation worked correct all along in this case … no record qualified in the first place.

The plugin doesn’t stop you sending to 0 subscribers, either by the conditions not matching any subscribers, or by having no conditions at all.

I created two new campaigns for which I didn’t need any special ‘Segment’ criteria. So I did not change anything on the Segment tab. Both email campaigns concluded immediately, with 0 emails sent.
So I went into the Segment tab and set an ‘obvious’ setting, e.g. ‘any’ Field_x must not be empty, of a field I know is not empty. Next, when started again, the campaigns started sending to all users on the selected lists.
I thought I could leave the Segment tab empty if I didn’t need any Segment checks.

I get a different result. When not entering any segment conditions, the message is sent to all the list members.