...

View Full Version : PEAR Mail - need help!



ntlhui
05-18-2011, 07:24 AM
I'm trying to set up an announcements page for a school club. The page is designed to have a form in which the officer types up the message and hits a button. The webpage then is supposed to post the message to the website (via MySQL, which works) and send the message to people using a mailing list. The announcement section works, but the mail section is giving me a hard time. The relevant code is below:


require_once "Mail.php";

$params['host'] = "sv8.byethost8.org";
$params['port'] = 465;
$params['auth'] = true;
$params['username'] = "..."; // email address redacted
$params['password'] = "...";

$smtp =& Mail::factory("smtp", $params);
if (PEAR::isError($smtp)) {
echo("<p>" . $smtp->getMessage() . "</p>");
}
$to = "..."; // email address redacted
$headers['From'] = "CHS Robotics";
$headers['To'] = "CHS Robotics Members";
$headers['Subject'] = "[CHS Robotics]".$title;
$headers['Date'] = date("r");
$smtp->send($to, $headers, $content);
if (PEAR::isError($mail)) {
echo("<!--" . $mail->getMessage() . "-->");
} else {
echo("<!--Message successfully sent!-->");
header("Location: viewAnn.php");
}

die;


The $title and $content variables have already been properly instantiated. The code now hangs at the
$smtp -> send($to, $headers, $content); line, which I've verified by commenting the line out and running it. The Mail, Net_SMTP and Net_Socket packages are installed in the same folder (my host has an issue with PEAR packages. The installer doesn't work). Any help?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum