Guides and Stats

The new support forum appears to be working and I think (so far) it is saving me time – time will tell if this trend continues. But something that may help further is a comprehensive guide to Subscribe2 produced independently by the iAssistant.

The guide is 40+ pages long and it provides an in depth set of instructions and descriptions of Subscribe2 features. I have had a very small part in the production of this guide (mainly pointing out additional areas of functionality and clarifying how some things work). It has been written in an easily understood manner that the novice will comprehend. I hope you will consider using this guide if you are struggling to start using Subscribe2.

CoverPage

And since the release of version 5.1 has bumped the download counter past the 200,000 mark and there have now been more than half a million visits to this site I guess there are quite a few of you who will find this guide worth every penny!

Posted in Admin, Plugin, Trouble Shooting. Tags: , . Comments Off

Support for Subscribe2

Many users of Subscribe2 post comments commending the outstanding support that is offered on the plugin and ruing the fact that this does not happen more. The sad fact is that a great number of the comments posted are either issues that have already been discussed many times over and the answers are already available, or they are requests for custom changes from the default plugin for an individuals benefit.

Recently, the folks at WordPress have reviewed their software licence and introduced Commercially Supported Themes on the main WordPress.org site. They have also introduced enterprise-level support for large-scale users of WordPress.

So, that leaves me wondering how to handle the continued support of Subscribe2. You see, much as though I think I should support my plugin and help people to use it as best they can I am often left bewildered that it seems to be overlooked that both the plugin and the support are currently FREE. And yet the level of functionality and support seem to be more consistent with that of software that has been bought!

Perhaps I should start acting more like other plugin authors and provide little to no support. Maybe I should direct everyone to the ReadMe and FAQ section of the website. Perhaps I should start charging for my assistance.

I really don’t know for sure what will happen next. I think I have decided already to start directing queries to the FAQ and ReadMe more however when I’ve done this in the past it really doesn’t save me any time – I still have to make the comment and I still usually get a follow up reply.

So, what would you do if you were me?

Error Messages

Subscribe2 attempts to check that emails have been successfully sent by reporting the callback returned by the WordPress wp_mail() function.

In your server or WordPress install are not correctly configured this can result in error message despite successful sending of emails.

To overcome these issues access the PHPMailer files directly, locate a language error file and uploaded to your WordPress site (wp-content/languages/ for example).

Next, get yourself a Mailer plugin like the one suggested here and put the following line in the code.

$phpmailer->setLanguage( 'en', '../wp-content/languages/' );

This will ensure that you don’t get:

Language string failed to load: instantiate

Mail Debug

Ben Forchhammer has just released a new plugin called Mail Debug.

This plugin could be of great assistance in finding out why emails are not being sent when using Subscribe2. The documentation states:

This plugin when activated automatically redirects all email sent through wp_mail/phpmailer to the user currently logged in.

The redirected email contains information about where the original email would have been sent to.

Use this plugin if you want to test email-sending features without actually sending emails our to anyone but yourself. I wrote this plugin to ease debugging with subscribe2.

So, if you are having problems with Subscribe2 then give this plugin a try.

SMTP Mailer

By far the majority of requests for help are still something to do with emails – mainly not sending! This is normally down to server restrictions that are based on limitations to recipients per email or time based choking.

One potential way around this might be to channel your emails via an SMTP server so the plugin below might be worth a try. Amend the plugin code below with your smtp server, your usewrname and password. Upload it and activate it then try sending your notifications. If it works send some kudos (or hard cash) my way! :D

<?php
/*
Plugin Name: SMTP Mailer
Plugin URI: http://subscribe2.wordpress.com
Description: Allows wp_mail() to send via SMTP server.
Version: 1.0
Author: Matthew Robinson
Author URI: http://subscribe2.wordpress.com
*/

/*
Copyright (C) 2006-8 Matthew Robinson

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
http://www.gnu.org/licenses/gpl.html
*/

/*
Instructions
1/ Change 'smtp.domain.com' to the server name of you out-going email server
2/ Change 'my_username' to your email mailbox username
3/ Change 'my_password' to your email mailbaox password
4/ Save this file and upload it to wp-content/plugins, then activate the plugin as normal
5/ Test is works by emailing a notification via Write->Subscribers in the Subscribe2 plugin
*/

add_action('phpmailer_init', 'wp_mail_to_smtp');

function wp_mail_to_smtp(&$phpmailer) {
	$phpmailer->Mailer = 'smtp';
	$phpmailer->SMTPAuth = true;
	$phpmailer->Host = 'smtp.domain.com';
	$phpmailer->Port = '25';
	$phpmailer->Username = 'my_username';
	$phpmailer->Password = 'my_password';
}
?>

Known Issues and Fixes

There are currently two known issues with Subscribe2 and it’s features that are being caused by the core WordPress files. If you feel comfortable editing PHP code here are the fixes:

Issue 1: Upon activating the plugin you may get an error regarding openbase_dir

Issue 1 has been fixed by an update to the WordPress core files.

To resolve this issue locate the file install-helper.php in wp-admin. On line 2 you’ll find the following
require_once ('../wp-config.php');

Change this to:
require_once (dirname(dirname(__FILE__)).'/wp-config.php');

Issue 2: When a Subscriber confirms a subscribption the webpage shown will replace the names of all your pages with “Subscription Confirmed”

Issue 2 has been fixed by an update to Subscribe2.

To resolve this issue you have two options:

Option 1: Comment out line 2183 in Subscribe2.php.

Change it from:
add_filter('the_title', array(&$this, 'title_filter'));

To:
//add_filter('the_title', array(&$this, 'title_filter'));

Option 2: Locate classes.php in wp-includes and edit line 521.

Change it from:
$output .= $indent . '<li class="' . $css_class . '"><a>ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a>';

To:
$output .= $indent . '<li class="' . $css_class . '"><a>ID) . '" title="' . attribute_escape($page->post_title) . '">' . $page->post_title . '</a>';

Testing Mail

By far the majority of requests for help are something to do with emails – either not sending or sending duplicates. With this in mind I have posted a Test Mail plugin in comments but WordPress.com replaces quotes with smartquotes resulting in errors when you try to copy and paste into a file.

So, try the following. This test plugin should result in an email being sent to the address you define on line 12 each time your website is loaded. So, don’t leave the plugin activated for long or you’ll fill your inbox!

You can copy and paste the code or download this file and rename it as a *.php file.

<?php
/*
Plugin Name: Mail Test
Description: PHP Mail Function Tester
Author: Matthew Robinson.
Version: 1.0
Author URI: http://subscribe2.wordpress.com
*/

function mail_test() {
//Define the following as your email address
$myemail = 'email@email.com';
// Leave the following alone
$subject = 'WordPress Email Test';
$mailtext = 'This email was sent from your WordPress blog by the Mail Test Plugin - your emails are working for simple mail';
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
$headers .= "From: " . $myemail . "\n";
$headers .= "Return-Path: " . $myemail . "\n";
$headers .= "Reply-To: " . $myemail . "\n";
$headers .= "X-Mailer:PHP" . phpversion() . "\n";
$headers .= "Precedence: list\nList-Id: " . get_option('blogname') . "\n";
@mail($myemail, $subject, $mailtext, $headers);
}

// Run our code after the plugins have loaded.
add_action('plugins_loaded', 'mail_test');
?>

Troubleshooting Failed emails

Okay folks, I get a lot of queries on here about the plugin and this is fine – to be expected in fact. The vast majority of them are about emails not arriving though so I thought I’d give you all some pointers.

Subscribe2 sends email notifications when you make a new post, it sends the email to you and puts all your subscribers email addresses into the BCC header of the email.

Now, the big problem with this is that this is a trick that SPAMMERS use! And for this reason a great deal of hosting provider impose limits on out going emails. Yes they still let you send emails and yes they give you a path to sendmail, but they only ley you send so many emails per minute or hour and they restrict the number of recipients in the BCC header.

Also, Subscribe2 follows the RFC2822 standards for email header formatting, some MTAs don’t follow it as strictly and this is where other problems arise.

Given the huge variety of hosting solutions (different web servers, web platforms, mail agents, blog setups and hosting limitations) you first port of call for failed emails (total or partial) should be your hosting provider.

They have access to your web log files and they should be able to tell you where and why your emails are being blocked. Armed with this information you will most probably be able to fix the issue or at least provide me with enough information to point you in the right direction!

As a footnote, I use Subscribe2 on my main blog site for work. I am now on VPS hosting because shared hosting repeatedly failed to send emails for my site due to anti-SPAM restrictions. Now I’m on VPS it works flawlessley without any edits to the Subscribe2 code.

BCC Header Troubleshooting

A Subscribe2 user, Beth has recently done a good deal of troubleshooting with her host to resolve some email sending issues she was having.

I have been asked to make this information more widely available as a possible solution to others – which makes perfect sense to me :-)

If you are finding that your outgoing emails are arriving at your Inbox and also that of the first recipient in the BCC Header, but that no other users are getting your email notifications this solution may help you.

First, an explanation of how the plugin constructs the BCC header. RFC822 standards state that the BCC header line can only occur once, cannot be more than 998 characters long and can wrap. The easiest way for the plugin to accomplish this is to add each BCC recipient onto a new line for the BCC header line.

The solution is to stop the wrapping on certain server setups, but you must ensure that your BCC header is not longer than 998 characters.

To do this, find all lines in the code as follows:

(” == $bcc) ? $bcc = “Bcc: $recipient” : $bcc .= “,\r\n $recipient”;

And change them to:

(” == $bcc) ? $bcc = “Bcc: $recipient” : $bcc .= “,$recipient”;

Note the removal of “\r\n”.

Finally, you’ll have to change the BCCLIMIT setting at the top of the code to ensure that the BCC line is not longer than 998 characters. Assuming that an email address would be 50 characters long a setting of 15 should allow ample space.

This may be arising because the PHP mail() function is not correctly parsing the BCC header over wrapped lines when passing the email directly to an SMTP server. You are welcome to try this fix but I feel that my interpretation of the RFC822 standards is valid and correct. The main code base will not be changing and this post is provided only as a possible solution.

Posted in Trouble Shooting. Comments Off

Widget conflict

A few comments posted here have raised an issue about the Widget.

Basically, there is a conflict between the Subscribe2 Widget and any other widget that makes use of the WordPress the_content function.

So far I am aware of the issue with:

And now the bad news :-( There is no fix!

My widget is a hack so that the Subscribe2 form that was originally intended for display on a page only can be included in the sidebar. I’m really sorry that there is no fix to this – at least none I can figure out an I’ve spent hours trying!

So, solutions:

  1. Put up with an ugly side bar
  2. Remove the Subscribe2 Widget and replace it with a link to your Subscription Page
  3. Remove other plugins that conflict with the Subscribe2 Widget