List of names with checkbox to send e-mail

kriskd - August 23, 2009 - 14:34

I coded a site in PHP that does the following functionality. I've love to turn it into a Drupal site, but module development has always been a bit above my head.

What I'm asking for is first, can this be done, and second maybe a few tips about what hooks/functions I'd need to use. I may never accomplish it, but it would be a good challenge.

So here it is.

1. Standard user registrations are off.
2. Someone finds the site and can enter their name and e-mail on a form. This is not an user registration and there is no user account or password associated with the name and e-mail.
3. Their name is added to a list (like a view). The list is a check box followed by the user's name.
4. Anyone can come to the site and view this list. They check one or many checkboxes and submit.
5. A form comes with subject, body field. Person fills this in and and and e-mail is sent from them to the users checked.

Disregarding spam and/or privacy concerns, can I get some tips on how I'd build a mod to do this.

You could: Create a content

jim0203 - August 24, 2009 - 01:09

You could:

Create a content type that anonymous users are allowed to create.
Use hook_menu to create a page and on that page use the form API to create a form which displays all of the different users, and a checkbox next to each entry, and a submit button. Store the selected users in a custom database table.
Use hook_menu and the form API again to create another page, on which you have your email form. Then use drupal_mail to fire hook_mail and send the emails out.

All of these hooks are relatively straightforward for what you want to me, apart from hook_mail and drupal_mail which are a little tricky. I'd suggest looking at the source for http://drupal.org/project/forward.

 
 

Drupal is a registered trademark of Dries Buytaert.