0

i would like to send email from PHP using libraries that comes with XAMPP (Windows) using GMAIL SMTP.I also want to send attachments.

will any one post a tested code on default installation of XAMPP in windows?

4

1 回答 1

1

您可以使用PHPMailer在 PHP 上通过 Gmail 发送电子邮件。

例子:

require_once('class.phpmailer.php');

$mail             = new PHPMailer();

$mail->IsSMTP();
$mail->SMTPAuth   = true;
$mail->SMTPSecure = "tls";
$mail->Username   = "yourusername@gmail.com";
$mail->Password   = "yourpassword";          
$mail->Host       = "smtp.gmail.com";
$mail->Port       = 587;           

$mail->SetFrom('yourusername@gmail.com', 'Your Name');
$mail->Subject    = "My subject";
$mail->Body    = "My body";

$mail->AddAddress("someone@example.com", "Recipient name");

$mail->Send();    
于 2013-08-31T14:17:28.753 回答