The email body is not visible in the email readers - I tried Outlook Express and Gmail - in both shows blank email. I checked the source of the email and the content is there. So, I guess there is some kind of syntax issue.

Comments

gemini’s picture

I made some changes to this function and seams to work fine for me:

function autoresponder_mail($u, $message) {
  srand(time());
  $to = $u['email'];
  $from = variable_get('site_mail', ini_get('sendmail_from'));
  $subject = $message['subject'];
  $mime_boundary = "==Multipart_Boundary_x".md5(mt_rand())."x";
  $url = url('autoresponder/unsubscribe/'.$u['uid'], NULL, NULL, TRUE);
  $unsubscribe_text = "-------------------------\nTo unsubscribe from the list follow this link $url".
  $unsubscribe_html = "<small>-------------------------<br />To unsubscribe from the list follow this link <a href='$url'>$url</a></small>";
  $headers = "From: $from\r\n" .
            "MIME-Version: 1.0\r\n" .
            "Content-Type:multipart/alternative;\r\n" .
            "\tboundary=\"{$mime_boundary}\"\n";
  //$headers.= "From: $from\r\n";
  $text = "This is a multi-part message in MIME format.\n\n" .
         "\n--{$mime_boundary}\n" .
         "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
         "Content-Transfer-Encoding: 7bit\n\n" .
         strip_tags($message['body'])."\n".$unsubscribe_text."\n".
         "\n--{$mime_boundary}\n" .
         "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
         "Content-Transfer-Encoding: 7bit\n\n" .
         $message['body']."\n".$unsubscribe_html."\n";
  $text = wordwrap($text, 70);
  return mail($to, $subject, $text, $headers);
}
aleksey.tk’s picture

Assigned: Unassigned » aleksey.tk
Status: Active » Fixed

I fixed this issue by rewriting mail sending function. Now module uses mimemail module (http://drupal.org/project/mimemail) to send emails.

Anonymous’s picture

Status: Fixed » Closed (fixed)