When I send the following test to the free server;
Code: Select all
<?php
$to = "XXXXXX@msn.com"; $subject = "test this"; $message = "sent";
if (mail($to, $subject, $message)) echo "success!";
?>Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache\Apache2\WEB_Pages\mail_test.php on line 3
The php.ini is set to localhost and port 25.
ping localhost works OK.
the php code looks like this:
Code: Select all
// phpMailer---------------------------------
require_once ("phpmailer/phpmailer.lang-en.php");
require_once ("phpmailer/class.phpmailer.php");
require_once ("phpmailer/class.smtp.php");
// phpMailer---------------------------------
// Instantiate your new class
$mail = new phpMailer;
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true;
$mail->From = $InstitutionDepartmentEmail ;
$mail->FromName = $InstitutionName." ".$InstitutionDepartmentName ;
$mail->Host = $Institution_SMTP_host_name ;
$mail->Username = $Institution_SMTP_host_userName ;
$mail->Password = $Institution_SMTP_host_pwd ;
// $mail->HostTLS = $Institution_SMTP_host_TLS ;
$mail->Mailer = "smtp"; // Alternative to IsSMTP()
$mail->WordWrap = 75;
//-----------------------------------------------------
$Subject = "Billing for ".date("F-Y" );
$Body = "Your Statement for ".date("F-Y" )." is attached to this email as a PDF file." ;
//-----------------------------------------------------
// Now you only need to add the necessary stuff
$mail->AddAddress( $Department_email );
$mail->Subject = $Subject ;
$mail->Body = $Body ;
$mail->AddAttachment("INC/Statements/".$PDF_Filename ); // optional name
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
$mail->ClearAddresses();
$mail->ClearAttachments();Warning: fputs(): supplied argument is not a valid stream resource in C:\Apache\Apache2\WEB_Pages\INC\phpmailer\class.smtp.php on line 146
Warning: fgets(): supplied argument is not a valid stream resource in C:\Apache\Apache2\WEB_Pages\INC\phpmailer\class.smtp.php on line 1024
Message was not sent.Mailer error: Language string failed to load: from_faileddanbloch1@msn.com
Warning: fputs(): supplied argument is not a valid stream resource in C:\Apache\Apache2\WEB_Pages\INC\phpmailer\class.smtp.php on line 146
Warning: fgets(): supplied argument is not a valid stream resource in C:\Apache\Apache2\WEB_Pages\INC\phpmailer\class.smtp.php on line 1024
Message was not sent.Mailer error: Language string failed to load: from_failed and xxxx@msn.com (my email address).
thank you for sharing your time with me.
dan bloch