PDA

View Full Version : سوال تکراری - مشکل در ارسال ایمیل با phpmailer



white tower
یک شنبه 06 بهمن 1392, 23:06 عصر
سرچ کردم ولی به جواب نرسیدم.
می خوام با phpmailer از طریق اکانت جی میل و از لوکال ایمیل ارسال کنم.این کد رو هم اجرا می کنم ولی پیغام Message Don`t Send میده.مشکل از کجاست؟میشه راهنمایی کنید


require_once 'phpmailer/class.phpmailer.php';
require_once 'phpmailer/class.smtp.php';
$mailer = new PHPMailer(); //create an object
$mailer->IsSMTP();
//$mailer->IsHTML(true); // if you send text message, comment this line
$mailer->Host = 'ssl://smtp.gmail.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'white.tower@gmail.com'; // Change this to your Gmail address
$mailer->Password = '******'; // Change this to your Gmail password
$mailer->From = 'white.tower@gmail.com'; // This HAVE TO be your Gmail address
$mailer->FromName = 'sample name'; // This is the from name in the email, you can put anything you like here
//$mailer->Body = '<table border="1"><tr><td>This is the main body of the email</td></tr></table>';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress(''white.tower@gmx.com'); // This is where you put the email address of the person you want to send this email
$mailer->ContentType = 'text/html';
if($mailer->Send())
echo 'Message Send';
else
echo 'Message Don`t Send';