2012-02-17, 07:06 PM
In one of my plugins I am using the mailqueue to send emails on new posts, however I need to send them with a reply-to header set to the poster email.
One issue is that the send_mail_queue() routine overwrites the Reply-To: header I set in the headers attribute of the mail queue I insert. This occurs in the set_common_headers() function of the mail handler.
So that leaves me with using the my_mail function directly as it supports a $return_email parameter. However, I use this function, the message body looses all the new lines and just shows \r\n\ in the message body.
I find this odd since I am sending the same $db->escape_string($post['message']); variable to both the my_mail() function as well as inserting it into the mail queue
This gives me the correct reply-to, but leaves \r\n as text in the message without any line breaks:
this gives me the correct message body with line breaks, but overwrites the reply-to:
I can not see where in the my_mail() process that the message is getting double escaped.
Maybe I am just missing the obvious. Can anyone help?
One issue is that the send_mail_queue() routine overwrites the Reply-To: header I set in the headers attribute of the mail queue I insert. This occurs in the set_common_headers() function of the mail handler.
So that leaves me with using the my_mail function directly as it supports a $return_email parameter. However, I use this function, the message body looses all the new lines and just shows \r\n\ in the message body.
I find this odd since I am sending the same $db->escape_string($post['message']); variable to both the my_mail() function as well as inserting it into the mail queue
This gives me the correct reply-to, but leaves \r\n as text in the message without any line breaks:
my_mail($db->escape_string($notifyuser['email']),
$db->escape_string($emailsubject),
$db->escape_string($emailmessage),
$db->escape_string($post['username'])."<".$db->escape_string($post['email']).">",
"",
"",
false,
"text",
"",
$db->escape_string($post['email'])
);
this gives me the correct message body with line breaks, but overwrites the reply-to:
$new_email = array(
"mailto" => $db->escape_string($notifyuser['email']),
"mailfrom" => $db->escape_string($post['username'])."<".$db->escape_string($post['email']).">",
"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => 'Reply-To: '.$db->escape_string($post['email'])
);
$db->insert_query("mailqueue", $new_email);
I can not see where in the my_mail() process that the message is getting double escaped.
Maybe I am just missing the obvious. Can anyone help?
Lost interest, sold my sites, will browse here once in a while. It's been fun.