Reputation: 705
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?
Upvotes: 0
Views: 3643
Reputation: 669
You can send email via Gmail on PHP using PHPMailer.
Example:
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = "[email protected]";
$mail->Password = "yourpassword";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SetFrom('[email protected]', 'Your Name');
$mail->Subject = "My subject";
$mail->Body = "My body";
$mail->AddAddress("[email protected]", "Recipient name");
$mail->Send();
Upvotes: 1