Index: actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/actions/actions.inc,v
retrieving revision 1.4
diff -u -F^f -r1.4 actions.inc
--- actions.inc 29 Jan 2005 18:57:55 -0000      1.4
+++ actions.inc 24 Mar 2005 02:40:07 -0000
@@ -359,6 +359,8 @@ function action_node_assign_owner($op, $
  *
  */
 function action_send_email($op, $edit = array(), $node) {
+  global $base_url;
+
   switch($op) {
     case 'metadata':
       return array(
@@ -373,7 +375,33 @@ function action_send_email($op, $edit =
       $recipient = $edit['recipient'];
       $subject = $edit['subject'];
       $message = $edit['message'];
-      if (user_mail($recipient, $subject, $message, '')) {
+
+      $from = variable_get('site_mail', ini_get('sendmail_from'));
+
+      if(isset($node) && is_object($node) ) {
+        $replacement['[[title]]'] = $node->title;
+        $replacement['[[type]]'] = $node->type;
+        $replacement['[[teaser]]'] = strip_tags($node->teaser);
+        $replacement['[[body]]'] = strip_tags($node->body);
+        $replacement['[[uid]]'] = $node->uid;
+
+        if($user = user_load(array('uid' => $node->uid))) {
+          $replacement['[[username]]'] = $user->name;
+        }
+
+       $path = "node/$node->nid";
+        $path = drupal_get_path_alias($path);
+       $replacement['[[url]]'] = $base_url . "/" . $path;
+        //if ($alias != $path) {
+        //  $node->path = $alias;
+       // }
+
+
+        $subject = str_replace(array_keys($replacement), $replacement, $subject);
+        $message = str_replace(array_keys($replacement), $replacement, $message);
+      }
+
+      if (user_mail($recipient, $subject, $message, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from")) {
           watchdog('action', t('Sent email to' . " $recipient"));
       }
       else {
@@ -391,7 +419,7 @@ function action_send_email($op, $edit =
       // add form components
       $output  = form_textfield(t('Recipient'), 'recipient', $edit['recipient'], '20', '254', t('The email address to which the message should be sent'));
       $output .= form_textfield(t('Subject'), 'subject', $edit['subject'], '20', '254', t('The subject of the message'));
-      $output .= form_textarea(t('Message'), 'message', $edit['message'], '80', '20', t('The message that should be sent'));
+      $output .= form_textarea(t('Message'), 'message', $edit['message'], '80', '20', t('The message that should be sent. To insert node elements in a message, surround the element in double brackets. For example, use [[title]] to insert the node title in your message. The acceptable tags are [[title]], [[type]], [[teaser]], [[body]], [[uid]], [[username]], and [[url]].'));
       return $output;
       break;

@@ -420,4 +448,4 @@ function action_send_email($op, $edit =
   }
 }

-?>
\ No newline at end of file
+?>
