I need to use PHP mail()
function to send mail from localhost SMTP (using Wamp,Xampp or etc..).
can anybody give a tutorial?
I need to use PHP mail()
function to send mail from localhost SMTP (using Wamp,Xampp or etc..).
can anybody give a tutorial?
You can use this library to send email ,if having issue with local xampp,wamp...
I prefer using PHPMailer script to send emails from localhost as it lets me use my Gmail account as SMTP. You can find the PHPMailer from http://phpmailer.worxware.com/ . Help regarding how to use gmail as SMTP or any other SMTP can be found at http://www.mittalpatel.co.in/php_send_mail_from_localhost_using_gmail_smtp . Hope this helps!
Here's the steps to achieve this:
Download the sendmail.zip through this link
Open sendmail.ini and set the configuration as follows:
smtp_server=smtp.gmail.com
hostname=localhost
Access your email account. Click the Gear Tool > Settings > Forwarding and POP/IMAP > IMAP access. Click "Enable IMAP", then save your changes.
Run your WAMP Server. Enable ssl_module under Apache Module.
Next, enable php_openssl and php_sockets under PHP.
Open php.ini and configure it as the codes below. Basically, you just have to set the sendmail_path.
I hope this will work for you..
It seems impossible to include all parts in my post, instead, I'll point to instructions::
using HMailServer : https://stackoverflow.com/a/16814318/2377343
using various methods: https://stackoverflow.com/a/5773346/2377343
using SendMail files: http://blog.techwheels.net/send-email-from-localhost-wamp-server-using-sendmail/
(should work on WAMP, XAMPP or anything...)
you can directly send mail from php mail() function if you specified the smtp server and smtp port in php.ini, first ask the SMTP server credential to your ISP.
then just restart the apache server and it will start working. ENjoy ...
If any one of you are getting error like following after following answer given by Afwe Wef
Go to php.ini
Enter valideaccount@gmail.com as your email id which you used to configure the hMailserver in front of sendmail_from .
your problem will be solved.
Tested on Wamp server2.2(Apache 2.2.22, php 5.3.13) on windows 8
If you are also getting following error
You might have forgot to change the port from 25 to 465