Well, I solved it. I replaced pear mail with the default mail function.
Pear Can't send email on Shared Hosting
Question
I was working on a project for a client, it selects an email from a database and then sends an email to that address. Everything worked fine on my VPS server running CentOS 6, but when migrating to their shared hosting the program will no longer send the email. It will select the correct addresses, but no message will be sent, I've already installed Pear Mail and Mail_mime. Any thoughts?
This code connects to the server:
$headers['From'] = 'mail@openmailbox.org';
$headers['To'] = 'mail@openmailbox.org';
$headers['Subject'] = $asunto;
$params['host'] = 'smtp.openmailbox.org';
$params['port'] = '25';
$params['auth'] = 'PLAIN';
$params['username'] = 'mail@openmailbox.org';
$params['password'] = 'password';
This code selects the recipients:
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$addresses[] = $row['email'];
}
$recipients = implode(", ", $addresses);
Hope you can help me!
Solution 2
OTHER TIPS
Here, this is my email sending code
$mail =& Mail::factory('smtp', $params);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$body = $mime->get();
$headers = $mime->headers($headers);
$mail->send($recipients, $headers, $body);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow