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?
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 = "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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.