tips and tricks for movable type

receive email of notification subscribers
November 23, 2002

Timothy Appnel offered up this MT hack for receiving an email when someone adds their address to your notification list.

Open mt-add-notify.cgi in a text editor (always save a backup copy!) and look for the last line:

print $q->redirect($q->param('_redirect'));

Replace with:

<!-- Send subscription notification hack start-->
my $webmaster_email='foo@bar.com'; require MT::Mail;
my %head = ( TO => $webmaster_email, FROM => $webmaster_email, Subject => 'New subscription notice');
my $body = $q->param('email').' has requested to be notified when your site is updated.';
MT::Mail->send(\%head,$body) or die MT::Mail->errstr;
<!-- end hack -->

print $q->redirect($q->param('_redirect'));

where foo@bar.com is the email address you want your messages sent to.

Upload the new version of mt-add-notify.cgi to your server and make sure permissions are set to 755.

Comments

Thanks Girlie,
It works great (I had to remove the <!--comments--> though...)

Too bad that I will forget this after updating to a next MT-release....

Lawrence

by Quadsk8 | 11.25.02 03:13 PM

i have to say your site is awesome. :) thanks for putting all of this together.

just one quick question, though......do you know if there's anyway to add to the subscription notification something that states which blog you're receiving this from? thank you!

by reb | 02.04.03 04:22 PM

Lawrence: the "comments" as shown above are the HTML format for commenting out....meaning (note: less than and greater than signs replaced with [ and ] )

[!-- comment --]

however they should be in Perl format...meaning:

# comment

to work properly.

reb: it's a two part thing....1st: in your template where the form is to submit the address being subscribed, find this:

[input type="hidden" name="blog_id" value="[$MTBlogID$]" /]

and ADD right after it:

[input type="hidden" name="blog_name" value="[$MTBlogName$]" /]

Then, 2nd, look for the line in mt-add-notify-cgi that begins:

my %head = ( TO => $webmaster_email

and make it look like this:

my %head = ( TO => $webmaster_email, FROM => $webmaster_email, Subject => $q->param('blog_name'). 'new subscription notice');

And you should be all set.

by dwaber | 07.01.03 10:49 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 5
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/112)

» notify form
Excerpt: Hacks to mt-add-notify :) receive email of notification subscribers Add URL to notify form addition
Weblog: lovelinks
Tracked: 02.17.03 12:16 AM

» Notification Notification
Excerpt: I would like to know when people sign up to be notified. I know it can be done, in my MT readings I've stumbled across it. Well, I found one thing over at girlie matters, and implemented it, but it's...
Weblog: Uncategorizababble
Tracked: 07.01.03 10:54 PM

» Tweaking A Hack
Excerpt: Dave to the rescue!
Weblog: XOXOX
Tracked: 07.01.03 10:57 PM

» Movable Type Enhancements
Excerpt: In trying to determine whether Movable Type (MT) was a feasible backend for OK/Cancel, I found a variety of sites and discovered just how big the MT community really was. If there's a function you can think of (and many...
Weblog: my:dentity
Tracked: 09.28.03 11:33 AM

» Weblog Verbesserung
Excerpt: Heute bin ich über eine kleine interne Verbesserung für dieses Weblog gestolpert und habe es gleich installiert. Hier geht es zum Hack im Girlie matters Weblog...
Weblog: Dom's Weblog für Webmaster
Tracked: 04.07.04 09:09 AM