I am new to php and in my project I have used php mail function, but while sending mail from database it shows an error like:
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP"
By searching on and google, I come to know that XAMPP does not provide SMTP server and I will have to install a SMTP server.
I am really confused.So, Which SMTP server I should install?
For this example, I will use PHPMailer.
So first, you have to download the source code of PHPMailer. Only 3 files are necessary :
Put these 3 files in the same folder. Then create the main script (I called it 'index.php').
Content of index.php :
You can also add 'CC', 'BCC' fields etc...
Examples and documentation can be found on Github.
If you need to use another SMTP server, you can modify the values in
Note : you may have a problem sending the mail, like 'Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto'.
In such case, you must enable the OpenSSL extension. Check your
phpinfo(), look for the value of 'Loaded Configuration File' (in my case : E:Program Fileswampbinapacheapache2.4.2binphp.ini) and in this file, uncomment the line
extension=php_openssl.dll. Then, restart your XAMPP server.