Search code examples
phpemailmercury-mta

How to send email using XAMMP


Here is my code in php to send email:

<?php
    $to = 'xyz@xyz.com';
    $subject = 'Customer_Details Report';
    $msg="some message";

    if($result)
    {
        echo 'your email has been sent';
    }
    else
    {
        echo'email not sent';
    }
?>

How do I set up mercury in XAMPP to send the mail.


Solution

  • First you need to configure the php.ini and sendmail.ini files correctly.

    The sendmail.ini file should contain

    first smtp_server=mail.gmail.com ,
    second smtp_port=465 (if not worked try 587),
    third auth_username= xxx@gmail.com auth_password=yourpassword
    

    after this restart your server.