Help - Search - Members - Calendar
Full Version: Adding entry title into notification e-mail
Movable Type Community Forum > Additional Resources > Tips and Tricks
btrott
Open up lib/MT/App/CMS.pm in a text editor. Find line 1405:

CODE
Subject => $blog->name . ' Update' );


That is the subject of the message, so I suppose you could just change it to

CODE
Subject => $blog->name . ' Update [' . $entry->title . ']' );
btrott
The title is in

CODE
$entry->title
btrott
The date is in

CODE
$entry->created_on


in YYYYMMDDHHMMSS form. You can format it like this:

CODE
MT::Util::format_ts('%B %d, %Y', $entry->created_on)


where '%B %d, %Y' is the format string.
kitykity
See?  I use the search feature to avoid making new posts on old topics!   tongue.gif

Every day, once a day, when I post in my kityLog, I would type in a boring email "there is a new entry in the kitylog entitled..." blah blah blah.  I just wanted to click on one button and BOOM have the email sent.  so here is what I changed:

CODE
   my $name = 'New' . $blog->name . ' Update';
   my $fill_len = $cols - length($name) - 2;
   $fill_len++ if $fill_len % 2;
   $name = ('There is a new entry in the ' . $blog->name . ' entitled ' . $entry->title . '.');
   $body .= $name . "\n\n";
   my @ts = offset_time_list(time, $blog);
   my $ts = sprintf "%04d%02d%02d%02d%02d%02d",
       $ts[5]+1900, $ts[4]+1, @ts[3,2,1,0];
   my $date = format_ts('%B %e, %Y', $ts, $blog);
   my $fill_left = ' ' x int(($cols - length($date)) / 2);
   $body .= "$fill_left$date\n\n";
   $body .= ('-' x $cols) . "\n\n";

(as you can see I removed those annoying parentheses and took out some extra spacing too.)

Thanks guys!
- Susan
theNonsuch
Hi, all -

Would it be rather complicated to have the entry title displayed in the notification e-mails? How much code hacking would that require?

Thanks,
Neil
johnk
I would like to add the entry title into the body of the notification email. I don't mind having to hack a bit, but I haven't been able to work it out! What do I need to use to pull in the title?

I would also like the date in the body of the email to be the entry date, not the current date as I sometime post entries retrospectively. Is there a way of doing this without too much aggro?

Thanks
John
johnk
Thanks -- got it now!

Is there a way as easy as this to access the entry date?

Thanks
John
johnk
Perfect!

Thanks  :D

John
francois
Amazing. I *just* came to the forums now to post this very same question; thank goodness I spotted this first. Just for my own satisfaction, as I've already written my post, here's what I wanted to achieve,

"[blogname] New Comment Posted" is the default email comment notification Subject line. It would be much better if this was, say,
"[blogname] New comment on 'Post Title'"

Anyway, thanks for the advice, Ben!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.