optikalefx Posted March 9, 2011 Share Posted March 9, 2011 I know there has got to be some server config somewhere. But I have a site with about 8000 users. And 20% or so can never receive "forgot email" passwords. A lot of them checked their junk and its not there, it just never gets delivered. But for a lot of people it works fine. So... How can i get PHP mail() to work better. Right now im using swift mailer with this code function email($to,$subject,$body,$from="") { require_once 'packages/swift/swift_required.php'; $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject); $message->setFrom($from); $headers = $message->getHeaders(); if (!$headers->has('Reply-To')) { $headers->addTextHeader('Reply-To',$from); } if(!is_array($to)) $to = array($to); $message->setTo($to); $message->setBody($body,'text/html'); $result = $mailer->batchSend($message); $toString = implode(",",$to); $this->_log("EMAIL to $toString - $body - $result"); return $result; } What have you guys used for this kind of thing? Is there some server config everyone should do? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/230065-how-to-get-php-mail-to-work-more-reliably/ Share on other sites More sharing options...
dreamwest Posted March 9, 2011 Share Posted March 9, 2011 Its most likely the class. But doing it yourself is easier than you think. http://www.wizecho.com/nav=php&s=email Quote Link to comment https://forums.phpfreaks.com/topic/230065-how-to-get-php-mail-to-work-more-reliably/#findComment-1184919 Share on other sites More sharing options...
bh Posted March 9, 2011 Share Posted March 9, 2011 Hi, i suggest you to use PHPMailer PHP email transport class featuring multiple file attachments, SMTP servers, CCs, BCCs, HTML messages, and word wrap, and more. It can send email via sendmail, PHP mail(), or with SMTP. Methods are based on the popular AspEmail active server component. Update: But swiftMailer also a good choice or even better - http://forums.phplist.com/viewtopic.php?t=8270 Quote Link to comment https://forums.phpfreaks.com/topic/230065-how-to-get-php-mail-to-work-more-reliably/#findComment-1184924 Share on other sites More sharing options...
optikalefx Posted March 14, 2011 Author Share Posted March 14, 2011 Turns out I needed to make my FQDN correct. And hotmail had my site blocked. Now email is much better. Quote Link to comment https://forums.phpfreaks.com/topic/230065-how-to-get-php-mail-to-work-more-reliably/#findComment-1187531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.