Post by tompub2007 on Jun 2, 2010 15:26:14 GMT 7
hi everybody,
i have upgraded to FW 2.01.09, which support send system notification via Gmail account, but don't know why my PHP can't send email via Gmail account....
my php code below,
<?php
require_once('phpmailer/class.phpmailer.php');
// include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
// Smtp Setting
$mail->Host = "smtp.gmail.com"; // SMTP server (sets GMAIL as the SMTP server)
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->CharSet = "utf-8"; // Sets the CharSet of the message
$mail->Username = "xxx@gmail.com"; // GMAIL username
$mail->Password = "xxx"; // GMAIL password
// Smtp Setting
// Setting the Sender, Receicer, ...
$mail->SetFrom('xxx@gmail.com', 'xxx'); // Adds a "From" address.
$mail->AddAddress('xxx2@yahoo.com', 'xxx2'); // Adds a "To" address.
// Setting the Sender, Receicer, ...
// Setting the mail title, content ...
$mail->Subject = 'PHPMailer';
$mail->Body = "Hi,<br>This is the HTML BODY<br>"; // HTML Body
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true);
// $mail->AddAttachment('images/phpmailer.gif'); // attachment
// Setting the mail title, content ...
$mail->Send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
Many thanks,
Tom
i have upgraded to FW 2.01.09, which support send system notification via Gmail account, but don't know why my PHP can't send email via Gmail account....
my php code below,
<?php
require_once('phpmailer/class.phpmailer.php');
// include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
// Smtp Setting
$mail->Host = "smtp.gmail.com"; // SMTP server (sets GMAIL as the SMTP server)
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->CharSet = "utf-8"; // Sets the CharSet of the message
$mail->Username = "xxx@gmail.com"; // GMAIL username
$mail->Password = "xxx"; // GMAIL password
// Smtp Setting
// Setting the Sender, Receicer, ...
$mail->SetFrom('xxx@gmail.com', 'xxx'); // Adds a "From" address.
$mail->AddAddress('xxx2@yahoo.com', 'xxx2'); // Adds a "To" address.
// Setting the Sender, Receicer, ...
// Setting the mail title, content ...
$mail->Subject = 'PHPMailer';
$mail->Body = "Hi,<br>This is the HTML BODY<br>"; // HTML Body
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true);
// $mail->AddAttachment('images/phpmailer.gif'); // attachment
// Setting the mail title, content ...
$mail->Send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
Many thanks,
Tom