2

Registered users were created first, then Simplenews was added.

How to set up mailing to all already registered users?

I get that you can send emails only to those who joined after you install the module. But I need the existing users' addresses included also.

4 Answers 4

2

I found a solution only cure addresses from the database, then export, and put them in a mass subscription.

1
  • This is better than the others that manually run SQL insert into the database
    – AdamS
    Feb 6, 2019 at 14:42
1

I just did the following successfully on an up-to-date Simplenews module, with a 3000+ user base. The answer comes from http://cc.com.au/2010/02/03/drupal-simplenews-mass-subscribe

So what I do first is select the uid and email address for all authenticated users (the anonymous user has uid 0, so I select only users with a higher uid) and insert those into the simplenews_subscriptions table.

INSERT INTO simplenews_subscriptions(activated,mail,uid) SELECT 1,mail,uid FROM users WHERE uid > 0 ORDER BY uid ASC;

This automatically assigns a snid (subscription id) to each entry. You'll notice that rather than selecting a column value into the activated field, I just set it to 1.

Next, I need to find the taxonomy term ID (tid) for the particular newsletter to which I want to subscribe all users. You can find this either by listing the terms in the Newsletter vocabulary or by listing all newsletters. In both cases the term id will be shown in your web browser's status bar if you hover the mouse over the edit link: http://example.com/admin/content/simplenews/types/edit/42

On my Drupal site the tid is 42, so that is the newsletter number I want to subscribe my users to. I need to refer to them via the automatically assigned snid from the simplenews_subscriptions table, so I select that and insert it directory into the simplenews_snid_tid table, together with the correct tid.

INSERT INTO simplenews_snid_tid(snid,tid) SELECT snid,42 FROM simplenews_subscriptions;
0

D7 Solution

To add all users that are not already subscribers run this query

insert into simplenews_subscriber(activated, mail, uid)  select 1, mail, uid from users where uid not in (select uid from simplenews_subscriber) and uid > 0;

And to subscribe them to a newsletter run this query

insert into simplenews_subscription(snid, tid, status, timestamp, source) select snid, 31, 1, unix_timestamp(), 'manual' from simplenews_subscriber where snid not in (select snid from simplenews_subscription);

Remmember to replace the number 31 by the number of your newsletter.

0

You should be able to implement this using Views, VBO and Rules.

Create a view that lists your users (with filters, if you want), create a rules component that receives a user as argument and then subscribe the mail address of that user using the provided action (make sure you've enabled the simplenews rules module).

Then enable bulk operations on the view with that rules component.

Credit @Berdir https://www.drupal.org/project/simplenews/issues/1564988

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.