Topic: PHP 5 send() not working
no photo
Sat 09/27/08 05:46 PM
Well, here goes another overly technical question for this user base, but hey, it is worth a shot. I am running Fedora 9 with the xampp suite for development purposes. I have configured the appropriate .ini's to allow the send() to connect to smtp.gmail.com using ssl on 465. There are no issues with firewall blocking either, but for some reason the script just dies. Unfortunately there is no error message, when I try to assign a variable by reference to the mail header it just kills that script . Any idea why?

I'll provide the source if needed.

drew_is's photo
Mon 09/29/08 07:13 PM
Sounds like you know the basics of doing it ... using the openssl and the ssl:// prefix, the right port, etc ... I guess a script might help to diagnose. What version of php/xampp did you install?

no photo
Tue 09/30/08 02:21 AM
XAMPP 1.6.7
Using the PHPmailer script.
It dies after the first reference assignment. ie $mail-> reference = var.

Here's what I have.

<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);

echo"<p>after error_reporting</p>";

date_default_timezone_set('America/Toronto');

include("php-includes/class.phpmailer.php");
//include("php-includes/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

echo"<p>after includes</p>";

$mail = new PHPMailer();

echo"<p>after mailer</p>";

$body = "Test";
$body = eregi_replace("[\]",'',$body);

$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server

$mail->Username = "me@gmail.com"; // GMAIL username
$mail->Password = "mypass"; // GMAIL password

$mail->AddReplyTo("me@gmail.com","My name");

$mail->From = "me@gmail.com";
$mail->FromName = "Admin";

$mail->Subject = "PHPMailer Test Subject via gmail";

$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 50; // set word wrap

$mail->MsgHTML($body);

$mail->AddAddress("me@gmail.com", "My name");

$mail->AddAttachment("Images/phpmailer.gif"); // attachment

$mail->IsHTML(true); // send as HTML

echo"<p>after mail</p>";

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

echo"<p>after send</p>";

$xportlist = stream_get_transports();
print_r($xportlist);
phpinfo();
?

chrish's photo
Thu 10/09/08 10:59 AM
Run the following:

<?php phpinfo(); ?>

I expect your PHP isn't compiled with SSL support.

WordsmithGuy's photo
Fri 10/10/08 11:34 AM
Since you're using Fedora, why are you not using sendmail in your php.ini?