Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Mailer will not find Exchange Server

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
0
0
GB
I am trying to get PHP Mailer up and running.
I am using a Microsoft Exchange Server

I am using the following code.
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.servername.domain_name.com 25"; // SMTP server
$mail->From = "admin@domain.com";
$mail->AddAddress("pperson@domain.com");

$mail->Subject = "first mailing";
$mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !";
$mail->WordWrap = 50;

if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>


I am getting the following error:
Message was not sentMailer Error: Language string failed to load: connect_host

Please note that I am having no problems using the PHP mail() function.
 
from the phpmailer documentation
$Host
PHPMailer::$Host in class.phpmailer.php
Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").

Seems to me you are missing : between the URL and the port
 
I changed the line to

$mail->Host = "smtp.servername.domain_name.com:25"; // SMTP server

and I am still getting the same error message
 
The following worked for me

$mail->Host = "servername.domain_name.com:25"; // SMTP server

 
Some systems run a named SMTP server rather than having just servername.domain.com:25
This is often used to switch the virtual server to a different physical machine when e.g. maintenance occurs. In your case there is no such setup and your server accepts connections on port 25 directly.
PHPMailer's verdict: not guilty.
 
Is the smtp server responding to external requests? Have you tried to Telnet to the server?

I had some problems connecting to by smtp server and by telnetting to the server and reading the responses and such I figured out what went wrong in my case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top