Creating the newsletter

First define a test email address for testing purposes in here: /#overlay=admin/config/services/simplenews/settings:

Then create a newsletter:

Go to /#overlay=node/add/simplenews

Fill in the basic information:

Now you have a newsletter to send:

Hit the Newsletter tab and you see this:

Hit Submit and you will receive this kind of email in your test email address:

Configuring the newsletter

Default settings

You can change the default settings, like:

  • default format
  • test email address
  • sender information
  • confirmation email templates
  • number of newsletters to send per cron run etc..

in here: /#overlay=admin/config/services/simplenews/settings (see the tabs also)

Newsletter categories

You can add categories and change their settings, like:

  • if new user is automatically subscribed to newsletters with that category
  • is confirmation emails sent when (un)subscribing etc..

in here /#overlay=admin/config/services/simplenews

Created newsletters

Created newsletters can be found here /#overlay=admin/content/simplenews

Using templates

First select the theme you like to use to render the emails in /#overlay=admin/config/system/mailsystem

There are 4 template files you can override in sites/all/modules/simplenews/theme:

  • simplenews-block.tpl.php
  • simplenews-multi-block.tpl.php
  • simplenews-newsletter-body.tpl.php
  • simplenews-newsletter-footer.tpl.php

Just copy them to your theme templates folder (like themes/bartik/templates) and edit them.

Sending HTML mails

Basic settings

  • Go to /#overlay=admin/config/system/mailsystem
  • Under New Setting select Mail > Simplenews module and save settings.

Now you can select only Simplenews module to use HTMLMailSystem under Simplenews module class.

Save settings.

Change your default format to HTML for all your newsletters in #overlay=admin/config/services/simplenews/settings

AND/OR for certain category in /#overlay=admin/config/services/simplenews. Edit the default category if you are using it!

Changing the newsletter

Now if you edit your newsletter and add html to it in /#overlay=admin/content/simplenews:

it will show in the email:

Also HTML in template files (simplenews-newsletter-body.tpl.php and simplenews-newsletter-footer.tpl.php) will show now.

HTML Mail template

To edit the HTML Mail template that wraps the simplenews templates, copy the htmlmail–simplenews.tpl.php file from sites/all/modules/htmlmail to themes/bartik/templates.

  • Go to /#overlay=admin/config/system/htmlmail and select Bartik as Email theme:

Setting up the cron

Your service provider might limit the number of emails you can send so go to /#overlay=admin/config/services/simplenews/settings/mail to change that. Let’s say the limit is 1000 mails per hour, so you might want leave space for other emails too and change the cron throttle to 500:

Now just set up a cron with your service provider (it’s recommended not to use poormanscron). Setup depends on the software but here’s one example using CPanel 11:

Go to Advanced / Cron jobs:

Add new Cron Job.

Read the instructions and ask the service provider how to do this if you’re not certain, but it probably goes close to this regardless of the system:

The command is:

1
php /home/u/public_html/cron.php >/dev/null 2>&1

u is the account name public_html is the root of your drupal install cron.php is your drupal cron file >/dev/null 2>&1 prevents you to get emails when cron runs

You might want to leave >/dev/null 2>&1 away and provide an email for testing purposes:

An easy way to test the cron is to create a simple file in public_html/test.php and write a mailing function to it: mail(“yourmail@gmail.com”,”test”,”test”); and make the cron run every minute with a job like this: php /home/u /public_html/test.php

You should also get some debug data if your provided an email in CPanel 11.

Subscribing existing users

You can use this sql code to subscribe all users to a newsletter category:

Make all subscribers:

1
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;

Subscribe them to a particular newsletter category:

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

Notice the number 1 . That’s the id number of your newsletter category. (Hover mouse over a category in here to see it: /#overlay=admin/config/services/simplenews)

You can run these in phpmyadmin for example:

  • Go to http://yoursite.localhost:8082/phpmyadmin
  • Select your site database
  • Hit Sql
  • Run the Queries separately:

With this you should be able to create cron driven full HTML newsletters.