Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I've been looking at a couple of modules and none of them seem to work the way I want to.

I'd like to display a textfield for an anonymous user to enter his email. Everytime a node of a certain type (blog post) is created, an email would be sent to every person who gave their email.

How could I achieve that in Drupal 7 ?

Thanks

share|improve this question
up vote 1 down vote accepted

Simplenews looks like it would work perfectly for this.

Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists. HTML email can be sent by adding Mime Mail module.

share|improve this answer

You can write your own custom module. If you are showing form as a block, you can use hook_block_info() or hook_block_configure() hooks

Then use YOURMOUDLE_form api to create form and implement the submit handler for the form i.e YOURMODULE_form_submit() where you write insert queries

Now to send the email you can use hook_node_insert() hook to do your things after the node is inserted in the tables

share|improve this answer
use simplenews module. You wont need custom coding – Serjas Nov 9 '12 at 4:16

Use rules module with the following information. Create a field for that content type called email.

Events After saving new content

Conditions Content is of type "select your content type"

Actions Send mail - and in the to section use your field token like [node:field-email] with an appropriate subject and message.

share|improve this answer
I checked rules, but did not understand how to send email to anonymous users. Any hint ? – Ebpo Nov 7 '12 at 14:04
@Ebpo checkout the videocast for rules as it is very framework and you will end up using it time and again. So take some time and run through all the videos nodeone.se/sv/node/32 – junedkazi Nov 7 '12 at 14:11
Didn't realize it was this big! I will look for sure :) Thanks for the info. – Ebpo Nov 7 '12 at 14:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.