Troubleshooting emails in Subscribe2

Over 6 years ago I briefly wrote about trouble shooting failed emails in Subscribe2. And 6 years later I still get this same issued raised time after time.

So, I thought it would be good to write a step by step guide to how you might go about testing and trouble shooting.

So, to start with some assumptions. I’m presuming you are using WordPress and Subscribe2 and you are using current release versions. I’m also presuming that you have followed the installation instructions for Subscribe2 and that you do successfully get some emails from your blog, for things like registrations and comments (if you aren’t getting these either then you have a wider failure in sending emails and you need to call your hosting provider).

Now we can work on some steps to try to get things working:

  1. Firstly, visit the Subscribe2->Settings page in the WordPress administration area. If you see any error messages in the red box over the top of the screen you need to get those fixed.
  2. Have you checked for conflicting plugins and themes? Check the list of known conflicts and if that doesn’t help then disable all plugins except Subscribe2 and revert to a core WordPress theme (like TwentyTwelve or TwentyThirteen). Test again and see if Subscribe2 works. If it does then you have a conflict somewhere, re-enable your theme and then plugins one at a time testing after each and every step to find the conflict. It would help greatly if you could let me know about conflicts too so the list can be kept up to date.
  3. In Subscribe2->Settings change the drop down selector where it says “Send Email From:” to a user account name and choose an account with an email address that end with your blogs URL. For example, if your blog address is http://www.my-blog.com the account should have an email address like admin@my-blog.com. Subscribe2 will display a warning message if the account has a different email address. After making the change test everything again.
  4. Next step, are you using Subscribe2 in per-post or digest mode?

Digest Mode
Digest mode sends a summary of posts made in a time period. The periodicity interval can be set by you but the event is triggered in the WordPress cron system.

  1. You need to check that the WordPress cron system is working. Install WP-Crontrol on your site and then visit Tools->Crontrol. Look at the “Next Run” times for events and in particular the subscribe2_cron event. If these are in the past then cron isn’t working. You might want to try adding define( 'ALTERNATE_WP_CRON', true ); to your wp-config.php file and see of that resolves the issue

Per-post Mode
Per-post mode sends posts at the time they are published (both live and scheduled). There are a few things that need checking and some of these apply to Digest mode too.

  1. In the Subscribe2->Settings page under the Email Settings tab make sure you have set the number of recipients per email to 1 (This is the default). Setting it higher than 1 sends a single email to groups of individuals and while this is a little more efficient it also looks a lot more like spam and is more likely to be blocked or filtered by anti-spam measures.
  2. In the Subscribe2->Settings page under the Registered Users tab make sure that you have not excluded any categories
  3. In the Subscribe2->Settings page under the Templates tab make sure that your templates are not empty
  4. Install an email logging plugin and then try sending a test email from the Suscribe2->Send Email page. Do the emails show in the log? Check the log again when you make a new post. If the emails are being logged then Subscribe2 and WordPress are generating the email and it is being blocked on the server, time to move to the next step.
  5. Speak with your hosting provider. Be patient with them. Ask them what restrictions or limitations they have in place on the sending of emails via the PHP mail() function. If they tell you it is not restricted ask them to check again, ALL hosting providers limit this function somehow otherwise they would be a spammer haven. Ask them exactly how the limit is applied and work with them to ensure your site remains within the restrictions. You may need an email queuing solution

Filtering the opt-out Authors

Version 7.0 of Subscribe2 introduced a new feature where Registered Subscribers could opt-out of receiving notifications from specific authors on multi-author sites.

Version 8.0 has improved on this a little by allowing site administrators to use a filter to trim down the list so unused author accounts can be removed from the list. To do this you simply code a small plugin extension something like this:

// 's2_authors' is the names of the new filter
add_filter('s2_authors', 'remove_author');
function remove_author($authors) {
	// our function takes an array of author objects as the input
	// you can then cycle through the array and remove any that you like on either 'ID' or 'display_name'
	$i = 0;
	foreach ( $authors as $author ) {
		// example use an if statement to check if author ID should be removed compared to a known ID
		if ( $author->ID == 1 ) {
			unset($authors[$i]);
		}
		$i++;
	}
	return $authors;
}

Themed User Subscriptions

One of the things I get asked about reasonably frequently is theming the “Your Subscriptions” page for end users.

If someone registers with your blog they can get additional control over their subscription by selecting which categories on your site they want notifications for and also the format of the email notification. It seems that some of you are not happy that this requires access to the WordPress administration menu area and you want to deploy the subscriptions form on the front of your site.

Well, there is good news. A developer has picked up on this request and is offering an extension for Subscribe2 that delivers exactly this functionality. And all they are asking for it is $2!

If this is something you want, go grab it here.

Subscribe2 and Custom Taxonomy Types

Subscribe2 was recently extended to allow notifications to be sent for Custom Post Types.

This introduction of code also highlighted the ability in WordPress to create Custom Taxonomy Types. Again, this is something done by developers and bloggers with a knowledge of PHP code.

Subscribe2 has now been extended again to allow the addition of custom taxonomies into the ‘categories’ that are used in WordPress by default. To add a custom taxonomy you have already created you need to added the following code into a custom plugin or to the function.php file in your theme.

function my_taxonomy_types($taxonomies) {
	// where 'my_taxonomy_type' is the name of your custom taxonomy
	$taxonomies[] = 'my_taxonomy_type';
	return $taxonomies;
}
add_filter('s2_taxonomies', 'my_taxonomy_types');

Subscribe2 and Custom Post Types

One of the new features introduced with WordPress 3.0 is custom post types. These are defined using code by developers and bloggers with a knowledge of PHP to allow WordPress to be extended to more of a CMS solution.

Subscribe2 can be enabled to send notifications for your custom post types by use of a filter. The code below give an example of how to register your custom post type with Subscribe2 so that these articles generate an email notification. I’d suggest you add this code to the plugin you are using to create your custom post type.

function my_post_types($types) {
	$types[] = 'my_post_type';
	return $types;
}

add_filter('s2_post_types', 'my_post_types');

Admin gets several emails

As previously covered in the FAQ section there are different subscriber types and different email preferences.

Each different email type is normally sent to admin with subscribers emails entered into the BCC Header (blind closed copy). This means your subscriber have the privacy of their email address maintained.

There are a maximum of four different emails types:

  • Plain Text – Excerpt
  • Plain Text – Full Post
  • HTML – Excerpt
  • HTML – Full Post

Emails are not sent if there are no subscribers but if there are subscribers admin will get a copy of the email.

Additionally, if you are on a host that restricts BCC: header length you can set the ‘number of recipients per email’ in the Settings area so that emails are constructed with size limited BCC: headers. This means your users will get the notification with the drawback being admin will get more emails.

If the number of recipients per email is set to 1 then emails are sent directly to individual addresses. Admin may not get emails in this case (if that address is not subscribed) and the emails may take longer to generate and send.

Posted in FAQ

Future Posts / Daily Digests don’t work

Future Posts and Daily Digest emails both rely on another plugin to function.

Both features set a future event in order to complete the task and this future event is defined as part of WP-Cron, an excellent plugin written by Skippy.

If you don’t have WP-Cron activated on your WordPress installation these features will not work (despite being available).

Posted in FAQ

Emails aren’t being sent

This is far too common a problem and in my experience is almost 100% down to server settings (apart from the one time I coded a bug into the email headers!).

SPAM is your enemy here. Many blog hosts are blocking or placing restrictions on the email sending capabilities of their servers (and rightly so!).

Subscribe2 sends emails to admin and puts subscribers email addresses into the Bcc: header space. Bcc: is used so that individual subscribers email addresses remain private to everyone except the blog admin.

If emails are “not arriving” check the following first:

  • Do other emails from your site arrive (e.g. WordPress registrations) – if not check if you host is allowing email sending, check you aren’t using an “off domain” email address as the sender
  • Are some users getting the emails and others not – check with your host for restriction relating to emails and get users to check their SPAM folders
  • Do regular publication emails arrive but future posts and digest emails don’t – you need WP-Cron for future posts and daily digest functionality

In summary lots of people use this plugin every day without problems – the issue is most likely with your set up or host.

However, there is some work-around functionality built into the plugin to cope with hosts who cap the number of recipients per email. There is a setting in the plugin specified as follows:

define('DREAMHOST', false);

(The reason the setting is called DREAMHOST is because this is the name of a hosting provider that caps the number of recipients per email!)

Anyway, set this to true in order to limit the number of recipients per email to 30. This may solve “No email” problems due to host email restrictions.

Posted in FAQ

HTML email

Subscribe2 allows Registered Users the option to receive emails in HTML format. Public Subscribers will only receive plain text emails containing an excerpt of the post.

The additional options given to registered users are intended to provide an incentive to sign up to the blog.

HTML emails are not officially supported for non-registered users. If you want this functionality please feel free to amend the code yourself or you can purchase amended code.

The off-the-peg HTML solution at a cost of $40US payable via PayPal is available via the WPPlugin store. The update code:

- Sends HTML emails sent to all confirmed public subscribers
- Has the ability to send HTML emails from Post->Mail Subscribers
- Sends Digest Emails containing HTML

Posted in FAQ

Subscriber types

Subscribe2 supports 2 different user types:

  • Public Subscribers
  • Registered Subscribers

Public Subscribers submit only their email address using the Subscribe2 form. They will receive an excerpt for each post made to the blog provided you have not published it to a category that you have defined as excluded in Options -> Subscribe2.

Registered Subscribers are users who have registered with your blog. They will have an additional option area under Users -> Subscription. This area allows them to choose which categories they would like to receive notifications about and also allows them to choose the email format.

In the Manage Tools -> Subscribers window you will see the different subscriber types. Registered on the right, confirmed public subscribers in the middle and unconfirmed public subscribers on the left.

In this panel administrators of blogs can manually add new public subscribers, confirm incomplete public subscribers and bulk subscribe registered users to defined categories.

Posted in FAQ