Jump to content

PHP MAIL taking a long time to be delivered?


Gayner

Recommended Posts

In my experience its usually server side, i know a couple of servers ive had where mail took an extremely long time to send. On those occasions i usually just use Pear's SMTP functions:

 

$from = "Name Here <[email protected]>";
$to = "Name Here <[email protected]>";
$subject = "Subject Here";
$host = "smtp.servername.com";
$username = "email_username";
$password = "email_password";

$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject );
$smtp = Mail::factory ( 'smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password ) );

$mail = $smtp->send ( $to, $headers, $body );

if (PEAR::isError ( $mail )) {
echo ("<p>" . $mail->getMessage () . "</p>");
} else {
echo ("<p>Message successfully sent!</p>");
}

 

A little bit harder than using the mail function but atleast it sends the mail immediately.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.