Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send mail using xampp in php

Tags:

php

sendmail

I've seen a lot of videos but haven't got a hang of how to send mail in php.

I've configured the smtp port and server along with php.ini file and also the sendmail.ini file, changed the auth_username and password. However, the code below still does not work!

<?php
    mail('[email protected]','Hello','Testing Testing','From:[email protected]');
?>

Do I need to download anything or change the gmail settings?

like image 869
user2280276 Avatar asked Apr 14 '13 18:04

user2280276


1 Answers

It's very easy to configure php.ini for sending e-mails from your server.You just need to configure php.ini and sendmail.ini correctly.

First you have to configure sendmail_path in your php.ini file it should have to point to executable sendmail file with proper flags

for example , ;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" (which is already in your php.ini file need to just remove comment) and other assignments to sendmail_path need to be commented.

after configuring php.ini file you need to configure sendmail.ini file ,in that

first smtp_server=mail.gmail.com (as you want to use gmail as smtp server), second smtp_port=465 (if not worked try 587), third auth_username= [email protected] auth_password=yourpassword

after this restart your server.

like image 78
Harshavardhan Avatar answered Sep 21 '22 03:09

Harshavardhan