Hello All,
I had not been able to reliably send emails with the PHP mail function. So I decided I would use the PEAR extension instead, but I am having the same issue. I am not connecting to an SMTP server. The issue appears to be that I cannot send any email outside the domain. I don't receive any errors but the email never arrives. However it works for internal addresses. Being that I am on a hosted server, do I still need to modify the PHP.ini file? I don't believe so because it was loaded by default. Here is the code, I got it from an example on the PEAR site and it is similar to others I have found:


$row = mysql_fetch_assoc($result);

$fname = $row['fname'];
$rmail = $row['email'];
$newpass = rangen();

$updte = "UPDATE members SET upass = '".md5($newpass)."' WHERE email = '".$rmail."'";
$res = mysql_query($updte);
if(!mysql_affected_rows() == 1){
$msg.= "Update failed:".mysql_error();

//Build the mail message
// Your name and email address
$sender = "Hey You <Me@mydomain.com>";
// The Recipients name and email address
$recipient = "Whats Up <You@yourdomain.com>";
// Subject for the email
$subject = "Your new Eternal Hour password";
// Text version of the email
$text = '
Hello '.ucfirst($fname).',
Here is your temporary password: '.$newpass.'.
Please change it from the preferences page after you log in.

Thank you,
// HTML version of the email
$html = '
<ul style="margin: 0px; padding: 0px;">Hello <span style="color: blue; font-weight: bold;">'.ucfirst($fname).'</span>,</ul>
<li>Here is your temporary password: <span style="font-weight: bold;">'.$newpass.'</span></li>
<li>Please change it from the preferences page after you log in.</li>
<li>Thank you,</li>
<li style="color: blue; font-weight: bold;">Support</li>
$crlf = "\n";
$headers = array(
                        'From'          => $sender,
                        'Return-Path'   => $sender,
                        'Subject'       => $subject

// Creating the Mime message
$mime = new Mail_mime($crlf);

// Setting the body of the email

$body = $mime->get();
$headers = $mime->headers($headers);

// Sending the email
$mail = Mail::factory('mail');
$mail->send($recipient, $headers, $body);

if (PEAR::isError($mail)) {
      $msg = $mail->getMessage() ;
$msg.= "Your password has been sent, please check your inbox.";

I have researched and researched this. If anyone is familiar with this package I would really appreciate some advice.

EDIT: This is obviously a snippet of code. I also have these includes as well:


If you are using a Web Hosting service you should contact them and see if they can help.

Not a bad idea Chris. It looks like eventually they were delivered, they just take a really long time.

Member Avatar


Hmm. I know that streamline.net hosting insist that you place a 'modifier' parameter in php mail(). However, if they have been finally delivered, perhaps there isn't a problem.

Perhaps. It takes around 30 minutes for the message to arrive, I am not sure if this is just due to Yahoo's email filters, AV or what, but that was the only domain I have tested. The other strange thing is that it is using the text email format, and I know Yahoo supports HTML mail because I get it all the time. Any ideas on that?

EDIT: The message format in my own domain is HTML.