My users are requesting an email notification when a new guestbook message is posted. I tried to do this with the action module but have been unsuccessful so far.

CommentFileSizeAuthor
#2 guestbook_message.module4.08 KBmfredrickson

Comments

ajwwong’s picture

Find this line in code:

// Insert new message

Then put this in front of it:

	// Send Email notification message
	$guestbook_owner = user_load(array('uid' => $uid));
	$to = $guestbook_owner->mail;
	$from = variable_get('site_mail', ini_get('sendmail_from'));
	$site_name = variable_get("site_name", "Drupal");
	$headers = "From: $from\nReply-to: $user->mail\nX-Mailer: Drupal\nReturn-path: \nErrors-to: $from\n";
	user_mail($to, "[".$site_name."] New guestbook entry", "Your guestbook has just been signed by '" .$user->name. "'\n\nThis guestbook listed message below will show up on your profile home page:\n\n". $message, $headers);

works for 4.7...

good luck!

Albert
www.ithou.org/Esalen

mfredrickson’s picture

StatusFileSize
new4.08 KB

I had a client that also requested this feature. I've implemented a more complete solution, available as an add-on module. I hope it can be included in the main line code after review, but for now, you can just drop this module into your modules directory and go with it.

Enjoy,

-Mark

hba’s picture

Assigned: Unassigned » hba

Thanks for the submitted code. I'll review it (and possibly include it into the guestbook) as soon as I have some spare time.

coltrane’s picture

Thanks mfredrickson for the module, it is very useful! I added a couple lines so that messaging is enabled by default for all users, perhaps if this feature makes it into the guestbook module there could be an option under the admin settings to make it enabled by default for all users?

Here's hoping this makes it into the main module. hba, I'd be willing to help in any way (rolling a patch perhaps) if needed.

Thanks!

hba’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Active » Fixed

E-mail notifications are included in 5.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)
andrenoronha’s picture

Version: 5.x-1.x-dev » 6.x-1.1

i'm using guestbook 6.x-1.1 and i receive notification emails, but these emails only show the content of the entry.
i'd like to customize it to send the user only a message "new message for you, click here to see it".

how can I arrive there?

ajayg’s picture

Status: Closed (fixed) » Active

There are several questions about this issue. If you want to close it, could some one please explain
what is so diffcult to add the senders name on line?

$message['subject'] = t('New guestbook entry at !site', $variables, $language->language);

if we can some how pass the user->name to this subject , that should solve the problem