Well... I'm desperate about this. I've been trying to send an email using the PEAR::Mail() function, and nothing seems to work. I've now got this code, which doesn't work at all. What am I doing wrong?
Code:
if(!empty($to) && !empty($subject) && !empty($text)) {
require_once('/Applications/MAMP/htdocs/PEAR/Mail.php');
$smtp = array("host"=>"ssl://smtp.gmail.com", "port"=>"465", "auth"=>true, "username"=>"my_mail@gmail.com", "password"=>"my_pass");
$mail = Mail::factory("smtp", $smtp);
$headers = array("From"=>$from, "Subject"=>$subject, "Cc"=>$cc, "Bcc"=>$bcc);
$sent = $mail->send($to, $headers, $text);
if(PEAR::isError($sent)) {
echo "<p>" . $sent->getMessage() . "</p>";
}
}