I'd like to "spoof" a mailcomment e-mail, such that I can customize who is goes out to outside of subscriptions using the rules module, but still have the ability for the receiver to "reply" to the comment via Mail Comment.

Given my experimentation, it seems that I'll just need the (((Please reply ABOVE this line))) text, then generate a MessageID at the bottom of the e-mail. Is this true? If so, can you provide the parameters / hashes used to generate MessageID? I'm not much of a coder/hacker, as I can't figure this out by poring over the mailcomment module code...

Thanks!

Comments

jjemmett’s picture

Status: Active » Fixed

MailComment looks for a message id (generated from some passed in parameters) in both the message header and signature area of the email. To hack your own email and send it via a rule/trigger, use something like the following:

$sender = 'systemaccount@yoursite.com';
$subject = "[New Comment] " . $node->title;
$body = $comment->comment;
$reply_text = variable_get('mailcomment_reply_text', t('((( Reply ABOVE this LINE to POST a COMMENT )))'));
$body = $reply_text . "\n<br/>" . $body;

$params = array();
$params['uid'] = $node->uid;
$params['nid'] = $node->nid;
$params['cid'] = 0;
$params['time'] = $node->created;
  
$headers['Message-ID'] = mailcomment_build_messageid($params);
$headers['Reply-To'] = $sender;

$result = mimemail($sender, $to, $subject, $body, false, $headers);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.