How to configure XAMPP to send mail from localhost?

后端 未结 11 2473
梦如初夏
梦如初夏 2020-11-21 05:17

I am trying to send mail from localhost. but i am unable to send the mail from localhost so can anybody tell me that how to reconfigure my xampp to send mail from localhost

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 05:33

    This code is used for the mail from your localhost XAMPP and your Gmail account. This code is very easy and working for me try your self.

    Below Change In php.ini File

    SMTP=smtp.gmail.com 
    smtp_port=587 
    sendmail_from = your@gmail.com 
    sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" 
    extension=php_openssl.dll 
    

    Below Change In sendmail.ini File

    smtp_server=smtp.gmail.com
    smtp_port=587
    error_logfile=error.log
    debug_logfile=debug.log 
    auth_username=yourmail@gmail.com 
    auth_password=your-gmail-password 
    force_sender=yourmail@gmail.com  
    

    Please write the belove code in your PHP file to send email

    ';
        $message .= 'Website Change Request';
        $message .= '';
        $message .= "";
        $message .= "";
        $message .= "";
        $message .= "";
        $message .= "";
        $addURLS = 'google.com';
        if (($addURLS) != '') {
            $message .= "";
        }
        $curText = 'dummy text';           
        if (($curText) != '') {
            $message .= "";
        }
        $message .= "";
        $message .= "
    Name: Details
    Email: Details
    Type of Change: Details
    Urgency: Details
    URL To Change (main): Details
    URL To Change (additional): " . $addURLS . "
    CURRENT Content: " . $curText . "
    NEW Content: New Text
    "; $message .= ""; if(mail($to,$subject,$message,$headers)) { echo "Mail Send Sucuceed"; } else{ echo "Mail Send Failed"; } ?>

提交回复
热议问题