Send Contents of new node by email (2nd attempt)
Hi Drupalfriends How can I send the contents of a node by email after it has been created? I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this point not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc). The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution. Any ideas are welcome? Best Regards Ernst
You could use the rules module, in a fairly complex way: Add you email sending rule as a new rule set. Enable the rules scheduler component, and set it so that 30 seconds after a new node is created the rule set is called with the node inserted. This might work, is probably over-complicated, you won't like the UI, but it's very flexible. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk 2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Hi Drupalfriends
How can I send the contents of a node by email after it has been created?
I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this point not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc).
The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution.
Any ideas are welcome?
Best Regards Ernst
Thanks for the hint! I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok). I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds. Is there a way to tell drupal (or apache) to do something in x Seconds? Best Regards Ernst 2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You could use the rules module, in a fairly complex way:
Add you email sending rule as a new rule set. Enable the rules scheduler component, and set it so that 30 seconds after a new node is created the rule set is called with the node inserted. This might work, is probably over-complicated, you won't like the UI, but it's very flexible.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Hi Drupalfriends
How can I send the contents of a node by email after it has been created?
I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this point not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc).
The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution.
Any ideas are welcome?
Best Regards Ernst
You might want to have a look at: http://drupal.org/project/notifications and its associated modules too. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk 2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Thanks for the hint!
I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok).
I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds.
Is there a way to tell drupal (or apache) to do something in x Seconds?
Best Regards Ernst
2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You could use the rules module, in a fairly complex way:
Add you email sending rule as a new rule set. Enable the rules scheduler component, and set it so that 30 seconds after a new node is created the rule set is called with the node inserted. This might work, is probably over-complicated, you won't like the UI, but it's very flexible.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Hi Drupalfriends
How can I send the contents of a node by email after it has been created?
I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this point not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc).
The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution.
Any ideas are welcome?
Best Regards Ernst
Great Module, but it seams that it only sends mails to known users. In my case the email addresses are taken form a cck field. Any other ideas? Best Regards Ernst 2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You might want to have a look at: http://drupal.org/project/notifications and its associated modules too.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Thanks for the hint!
I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok).
I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds.
Is there a way to tell drupal (or apache) to do something in x Seconds?
Best Regards Ernst
2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You could use the rules module, in a fairly complex way:
Add you email sending rule as a new rule set. Enable the rules scheduler component, and set it so that 30 seconds after a new node is created the rule set is called with the node inserted. This might work, is probably over-complicated, you won't like the UI, but it's very flexible.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Hi Drupalfriends
How can I send the contents of a node by email after it has been created?
I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this
point
not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc).
The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution.
Any ideas are welcome?
Best Regards Ernst
It'd be fairly simple to use hook_nodeapi and just detect there whenever someone creates a new node and send it off right away. PHPMailer is a nice library for actually sending the emails. --Kyle Mathews kyle.mathews2000.com/blog http://twitter.com/kylemathews On Thu, Jan 28, 2010 at 7:51 AM, Ernst Plüss <ernst.pluess@gmail.com> wrote:
Great Module, but it seams that it only sends mails to known users. In my case the email addresses are taken form a cck field.
Any other ideas?
Best Regards Ernst
2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You might want to have a look at: http://drupal.org/project/notifications and its associated modules too.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Thanks for the hint!
I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok).
I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds.
Is there a way to tell drupal (or apache) to do something in x Seconds?
Best Regards Ernst
2010/1/28 Steven Jones <steven.jones@computerminds.co.uk>
You could use the rules module, in a fairly complex way:
Add you email sending rule as a new rule set. Enable the rules scheduler component, and set it so that 30 seconds after a new node is created the rule set is called with the node inserted. This might work, is probably over-complicated, you won't like the UI, but it's very flexible.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
2010/1/28 Ernst Plüss <ernst.pluess@gmail.com>:
Hi Drupalfriends
How can I send the contents of a node by email after it has been created?
I installed the print module and tired to call their methods from hook_nodeapi up on $op=='instert'. But it turned out that at this
point
not all node information is saved, which causes a lot of funny side effects (access control, strange messages on screen, etc).
The best thing I found is to have a hidden iframe, when the contents is shown after the user hits send. The link of the iframe would call a call back url which triggers the mail functionality. But I'm not really happy with this solution.
Any ideas are welcome?
Best Regards Ernst
Hi, On 28/01/10 11:02, Ernst Plüss wrote:
I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok).
I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds.
You can do it with the rules module, but you won't need rules scheduler. Just use the event "After saving new content" and the action "Send a mail to an arbitrary mail address". If you have installed the token module, you can use token placeholders in the mail text, like content author or other properties of the content. -- Klaus Purer This E-Mail contains a digital signature and can be verified with this PGP|GPG Public Key: http://web.student.tuwien.ac.at/~e0426223/key/kp.asc
I was thinking (and trying) about rules as well. But I need some logic which evaluates the mail address in between. Running my own action would work of course. After all I installed mimemail and token and set up a little form so administration is easier for me. So my code looks like below now and does what i want. Thanks for all the help! if (!module_exists('mimemail')) { watchdog('zuweisung', t('Module mimemail is not installed. Unable to send emails.'), NULL, 'Critical'); return; } $sender = variable_get('site_mail', NULL); $recipient = variable_get('zuweisung_intake_mail_adr', NULL); $subject = token_replace(variable_get('zuweisung_intake_mail_subject', NULL), 'node', $node); $body = token_replace(variable_get('zuweisung_intake_mail_contents', NULL), 'node', $node); mimemail($sender, $recipient, $subject, $body); $sender = variable_get('site_mail', NULL); $recipient = $node->field_zuw_email[0]['email']; $subject = token_replace(variable_get('zuweisung_zuweiser_mail_subject', NULL), 'node', $node); $body = token_replace(variable_get('zuweisung_zuweiser_mail_contents', NULL), 'node', $node); mimemail($sender, $recipient, $subject, $body); 2010/1/28 Klaus Purer <klaus.purer@gmail.com>
Hi,
On 28/01/10 11:02, Ernst Plüss wrote:
I need a solution which sends the email right after the node has been created (30-60 Seconds delay would be ok).
I had a quick look at the rules scheduler code. Unfortunately it's not a real timer solution. It just wirtes a record to the db. The next time cron is run all sceduled rule sets which have expired are executed. I think it's not a good idea to call cron every 60 Seconds.
You can do it with the rules module, but you won't need rules scheduler. Just use the event "After saving new content" and the action "Send a mail to an arbitrary mail address".
If you have installed the token module, you can use token placeholders in the mail text, like content author or other properties of the content.
-- Klaus Purer This E-Mail contains a digital signature and can be verified with this PGP|GPG Public Key: http://web.student.tuwien.ac.at/~e0426223/key/kp.asc<http://web.student.tuwien.ac.at/%7Ee0426223/key/kp.asc>
participants (4)
-
Ernst Plüss -
Klaus Purer -
Kyle Mathews -
Steven Jones