1

I've inherited some legacy code that sends e-mail as follows:

$headers .= chunk_split(base64_encode($mailbody));
mail("my@email.com", $subject, "", $headers);

It looks strange because it uses no body, and encodes everything in base64 and puts it in the header. Because I'm hitting limits with the default send mail on my host, I'm switching to SMTP with PEAR's Mail package as follows

$mime->setTXTBody($body);
$mime->setHTMLBody($body);

$mimebody = $mime->get();
$mimeheaders = $mime->headers($headers);

$smtp->send($to, $mimeheaders, $mimebody);

An unexpected consequence is that for some reason gmail is now reporting my messages as spam. How do I get base64 encoding working with php and pear?

cweiske
  • 30,033
  • 14
  • 133
  • 194
deltanovember
  • 42,611
  • 64
  • 162
  • 244
  • 2
    that original snippet is weird, as it wont be creating valid email headers. to maximise your chances of getting through spam checks do this: http://www.transio.com/content/how-pass-spam-filters-php-mail –  Jan 21 '11 at 02:56

1 Answers1

0

You want to prevent your mails getting marked as spam. See How do you make sure email you send programmatically is not automatically marked as spam? for an answer.

Community
  • 1
  • 1
cweiske
  • 30,033
  • 14
  • 133
  • 194