Email From CCK Value

Events happening in the community are now at Drupal community events on www.drupal.org.
kurosevic's picture

Hi all,

I've searched through these threads and I haven't seemed to find an answer to this type of question..

I've created a form in which question 3 asks for an email address (of email field type), and once that form is submitted, I'd like the form's edit node to be emailed to that specified email address (which is not the email address of the user creating the form)

IF
node type: customer satisfaction survey
on submit

DO
Get value from field 3 (an email address)
Send email to email address referenced
Message contains a link to the edit node url of that form

what do you guys suggest?

Comments

Webform?

itangalo's picture

If you haven't tried the module Webform I recommend doing that. It does the very thing you describe (but does not create actual nodes of the submissions from users).

It could be done with Rules as well, but it might be overkill.
Write again if you're really interested in doing this with Rules, and I'll try to write something understandably about how to achieve it. :-)

Good luck!
//Johan Falk, NodeOne, Sweden

Interested in webform

Shadowfire-1's picture

Hi Itangalo. I'm interested in do that with a webform and rules (i think). How can i achieve this?

Thanks in advance.
Josep

Just use webform!

itangalo's picture

The Webform module has built-in functions for sending out e-mails, so you probably won't have to use Rules at all.

Check out Webform and write a new comment if you think there are some functions you're missing!

//Johan Falk, NodeOne, Sweden

the thing is...

kurosevic's picture

Itangalo, thanks for your response!

i have used webform in the past, and one of the problems facing me with this particular form is that i need to be able to use it with cck / views so i can do statistics from the form data... otherwise i'd have totally used it.

All right then!

itangalo's picture

I can definately understand that you want to use CCK if you want to display results with Views. Thats the major drawback with Webform…

So, here's how to send an e-mail to an address collected in a CCK field. It's not completely easy, but hopefully managable.

  1. A rule triggering on "after saving new content".
  2. Conditions checking that it is a node of the relevant type, and possibly some other stuff as well (perhaps that e-mail field isn't empty).
  3. Action: "Send a mail to an arbitrary mail address". Use tokens to get the CCK value from the email field, and then other tokens to populate the subject and message field.

There is – as far as I know – no way to get the full content of the node with a single token, and even if printing it out with PHP is possible it is probably not necessary. As long as you know what fields you have in your content type you can compose the message part-by-part (and get better control over the message as well).

Good luck!
//Johan Falk, NodeOne, Sweden

what shall my token be? how

kurosevic's picture

what shall my token be?

how do i determine it?

Token module

itangalo's picture

Oh, sorry about that. You'll need the Token module to get any tokens at all.
Once it is installed you'll get a list of available tokens. The name of the one you want depends on the name you've given the email field in question, but browse through the list and you'll find it.

//Johan Falk, NodeOne, Sweden

awesome, thank you very much

kurosevic's picture

awesome, thank you very much

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week