0

I have been trying so many times to send mail from xampp, for that I set all things which is required but still mail function is not working.

I have tried with the following steps:

  1. Remove ; from php.ini file where extension=php_openssl.dll

  2. [mail function]

    SMTP=smtp.gmail.com
    smtp_port=587
    sendmail_from = shail.gandhi132@gmail.com
    sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"
    
  3. C:\xampp\sendmail

    [sendmail]

    smtp_server=smtp.gmail.com
    smtp_port=587
    error_logfile=error.log
    debug_logfile=debug.log
    auth_username=shail.gandhi132@gmail.com
    auth_password=(My passowd)
    force_sender=shail.gandhi132@gmail.com
    
  4. And My PHP code is

     $to = 'sgandhi132@gmail.com';
     $subject = 'This is subject';
     $message = 'This is HTML message';
     $header ='From:shail.gandhi132@gmail.com';
     $send = mail($to,$subject,$message,$header);
    
     if($send == true) 
     {echo "Mail Sent";}
     else 
     { echo "Error";}
    
smartrahat
  • 5,381
  • 6
  • 47
  • 68
S. Gandhi
  • 109
  • 1
  • 10

0 Answers0