Real Consulting
Please Login or Register

Knowledgebase

mail() not working?

Please use authneticated mail such as PEAR or send_mail to send mails out. In the usual course mail() should work .But some times it will have to be blocked due to security reason .In such case use send_mail / pear.

Essentaily this is to reduces invitation to hackers and spammers.

PEAR EXAMPLE

// Make sure you have PEAR on your server . If not upload it.  http://pear.php.net/

require_once "Mail.php";

function emailHtml($from, $subject, $message, $to) {
$host = "localhost";
$username = "";// your username

$password = ""; // your password 


$headers = array ('MIME-Version' => "1.0", 'Content-type' => "text/html; charset=iso-8859-1;", 'From' => $from, 'To' => $to, 'Subject' => $subject);

$smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => false));

$mail = $smtp->send($to, $headers, $message);
if (PEAR::isError($mail))
return 0;
else
return 1;
}
 

 



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article


Powered by WHMCompleteSolution

Language:

Quick Navigation

Client Login

Email

Password

Remember Me

Search