Issue with using corporate mail server smtp function
Posted: Tue Jul 06, 2010 7:28 am
Hi,
I am having problems sending a mail by php using our corporate lotus mail server (please see the script below). By our IT department the lotus server on 192.168.20.99 requires NO authentication at all. When I run the script I get the following error message:
Failed to connect to 192.168.20.99:25 [SMTP: Failed to connect socket: No connection could be made because the target machine actively refused it. (code: -1, response: )]
I have no experience in php but the error message suggests me that my request is valid, but for some reasons the server rejects it. I have talked to the IT guys and we checked out the mail-server log which shows that there IS NO REQUEST arrived from my test-pc to the server. Which means it looks like the server does not rejects my request, it simply not even arrives!
To do my homework I installed outlook and created a new account which uses the IP and the Port number only. I was able to send messages to everywhere and the mail server log showed these messages without any problems.
So pretty much in outlook it works (outlook uses smtp as well to send out mails), but it does not work with php.
I am not sure if the script is correct since I just copied from the internet.
I use winXP with XAMPP (Apache and SQL running)
if you have any clue about what is wrong, please let me know, I need the solution desperatly!
thanks a lot,
istvan
I am having problems sending a mail by php using our corporate lotus mail server (please see the script below). By our IT department the lotus server on 192.168.20.99 requires NO authentication at all. When I run the script I get the following error message:
Failed to connect to 192.168.20.99:25 [SMTP: Failed to connect socket: No connection could be made because the target machine actively refused it. (code: -1, response: )]
I have no experience in php but the error message suggests me that my request is valid, but for some reasons the server rejects it. I have talked to the IT guys and we checked out the mail-server log which shows that there IS NO REQUEST arrived from my test-pc to the server. Which means it looks like the server does not rejects my request, it simply not even arrives!
To do my homework I installed outlook and created a new account which uses the IP and the Port number only. I was able to send messages to everywhere and the mail server log showed these messages without any problems.
So pretty much in outlook it works (outlook uses smtp as well to send out mails), but it does not work with php.
I am not sure if the script is correct since I just copied from the internet.
I use winXP with XAMPP (Apache and SQL running)
if you have any clue about what is wrong, please let me know, I need the solution desperatly!
thanks a lot,
istvan
Code: Select all
<?php
require_once "Mail.php";
$from = "istvanb@mycompany.com";
$to = "istvanb@mycompany.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "192.168.20.99";
$port = "25";
$username = "";
$password = "";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => false,
'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>");
}
?>