New Subscribers For Your Newsletter Thanks To Drupal

A few days ago, when I published the first news about boogeeks (hint, the first one is Drupal related), many readers registered for my newsletter to get the word on launch day and know about promotions.

Some of them contacted me and a after a few email exchanges decided to register for the newsletter and asked me to add them to the subscribers list. It was obvious that a little checkbox on the contact form would help. That's what I did: a module to get new subscribers to my newsletter from Drupal's contact form.

Newsletter Checkbox is a simple module for Drupal 5, haven't tested it with 4.7 yet, that uses hook_form_alter and a custom _submit function. The module adds a subscribe to newsletter checkbox at the bottom of your site's contact form, Contact must be active.

If users click on the checkbox, a couple of lines are appended to the message with their email address, then the administrator can manually add it to the newsletter.

Subscribe me to newsletter:
user@example.com

It's possible making a couple of changes to integrate Newsletter Checkbox with your favorite newsletter management application or service; I'm doing it with the API of Campaign Monitor.

Download Newsletter Checkbox, install it and let me know how it goes, or test it from my contact form, it's also a good chance to just say hi!

Updated: Get the Campaign Monitor version. It uses NuSOAP, included in the download, and you must insert your APIKey and ListID before using.

Join the conversation

useful idea. do you use simplenews.module as newsletter?

useful idea, do you use simplenews.module as newsletter?
as much as know its not been updated to V5 not sure HEAD works with the V5
would be nice your module adds mails to the simplenews.module, rather than a manual addition

I am using Campaign Monitor

I am using Campaign Monitor, which allows me to track how effective my newsletters are. I updated my module and now automatically add subscribers to Campaign Monitor.

I have used Simplenews, and I liked it, but this was a quick hack and I didn't think about it. Adding support for other newsletters managers should be just a matter of adding the right code to the custom submit function in Newsletter Checkbox. IF anybody does it, let me know.

I haven't had the time to test but I'm almost sure that this module should work with Drupal 4.7. There are just a couple of very standard hooks, one is just help text, and the custom submit function.

Cheers.

Alexis Bellido

More integration with Campaign Monitor

I have been wanting to have a module integrating Campaign Monitor into Drupal. Have you thought of extending this so that people can directly sign up to a site's newsletter and view older newsletters, etc. Or, creating a whole new module for Campaign Monitor in Drupal. I have been wanting to do this, so if you are interested in getting a team together for something like this, I would be interested.

Cheers,
Stephanie

Finding the time for Campaign Monitor and Drupal

Thanks Stephanie, it's a good idea. I'll try to find some time to work something out.

Campaign Monitor has a great API and I'm sure many drupalers will be glad to manage it without leaving their sites' administration sections.

Regards!

Alexis Bellido

Any news on integration w/ SimpleNews?

I noticed it's been about 9 months since the above exchange, and was wondering if in that time you'd heard from anyone who's been able to make this work with SimpleNews.

I did take a look at the code because I was interested in trying to do that, but I'm not sure where to start - it seems to be designed to send the info to an outside site's API via SOAP, and I'm not sure how to pass that to another module internally instead. (I haven't really got any substantial experience in Drupal module development, though I've made a few tweaks to other people's modules here and there.)

I think it would basically need to pass the information to the simplenews_subscribe_user function in simplenews.module, only I'm not sure how to make it do that. The contact form when submitted just goes to itself, so it would have to call the other module in the background somehow rather than submitting the form to it directly, and I'm not sure how that would be done. Any ideas?

No integration with SimpleNews yet

Sorry Lynna, not yet. I've been quite busy with other projects, including one to improve the Campaign Monitor module in other ways.

I'm making a note to revisit the SimpleNews issue in the future however.

Cheers.

Alexis Bellido

Is too expensive

I'm sorry to say but 'Campaign Monitor' is too expensive for me :(

How to modify it for Mailbuild

Hi, I use Mailbuild (Campaign Monitor's sister service) and I managed to modify your module to work with Mailbuild too. Here's how to do it in case your module users want to know too.

First you need to generate your Mailbuild API and list ID (http://www.mailbuild.com/api/)

Change the following changes in newsletter_checkbox.module

Line 54:
$s = new soapclient('http://yoursite.createsend.com/api/api.asmx');

Line 61:
$rVal = $s->call('Subscriber.Add',$prams,'http://api.createsend.com/api/', 'http://api.createsend.com/api/Subscriber.Add','','','rpc','literal');

Thanks for a really useful module!

Simplenews Modification

Hey there,

I took a stab at modifying this for use with Simplenews. Seems like the only required change is in the _newsletter_checkbox_form_submit function. Make the second argument of simplenews_subscribe_user the term ID of the newsletter you want the checkbox to apply to; for me it happened to be 2.


function _newsletter_checkbox_form_submit($form_id, $form_values) {
if ($form_values['subscribe_newsletter']) {
$email = $form_values['mail'];
simplenews_subscribe_user($email, 2, FALSE);
}
}

Thanks for laying the groundwork!

Simplenews

Great! and did it work fine with SimpleNews? I havent even tried Campaing Monitor because of the price. But SimpleNews is free and totally Drupal based.

I installed this module and

I installed this module and have it working in my website. Does the checkbox only suppose to appear in my Contact Form only for registered users? How can I make it appear for Anonymous Users as well? Also, I do not see the option to sign up to the mailing list on my user registration form. Any help would be greatly appreciated.

Keep your comments relevant, written in good English and don't spam. Let's create useful and valuable discussions. Markdown is welcome.

Add your comment