violet kiwi
violet kiwi

Reputation: 705

How to send email from PHP using XAMPP

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

Answers (1)

Jak S
Jak S

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

Related Questions