problem sending email
| From: | As'ad Djamalilleil | Date: | Thu, 24 May 2012 12:00:47 +0000 |
| Subject: | problem sending email | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317984@lists.php.net to get a copy of this message | ||
hi all,i'm having this problem in sending email using pear.
it just wont send :(
here's the code ..
<?php
require_once 'Mail.php';
$from_name = "My Self";
$to_name = "My Friend";
$subject = "Sending Trial";
$mailmsg = "GOD please make it work";
$From = "From: ".$from_name." <mymail@gmail.com>";
$To = "To: ".$to_name." <someone@yahoo.com>";
$recipients = "someone@yahoo.com";
$headers["From"] = $From;
$headers["To"] = $To;
$headers["Subject"] = $subject;
$headers["Content-Type"] = "text/plain; charset=iso-8859-1";
$smtpinfo["host"] = "smtp.gmail.com";
$smtpinfo["port"] = "465";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "mymail@gmail.com";
$smtpinfo["password"] = "mypassword";
$mail_object =& Mail::factory("smtp", $smtpinfo);
$mail_object->send($recipients, $headers, $mailmsg);
if (PEAR::isError($mail_object))
echo $mail_object->getMessage();
?>