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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With