tiamat2012
Programmer
Can anyone take a look at this code and tell me why?
It's telling me unable to connect to mail.earthlink.net:25, but I have used this type of thing before from an ASP.NET application, and earthlink sent it fine... can anyone see errors in the code?
-Kerry
P.S. the e-mails, username and password were changed from the valid ones.
Code:
require_once "Mail.php";
$from = "email@email.com";
$to = "email@toemail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.earthlink.net";
$username = "username@earthlink.net";
$password = "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>Error: " . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
It's telling me unable to connect to mail.earthlink.net:25, but I have used this type of thing before from an ASP.NET application, and earthlink sent it fine... can anyone see errors in the code?
-Kerry
P.S. the e-mails, username and password were changed from the valid ones.