0

I need to confirm user registration with entered email address but i am unable to send mail now the code worked 2 weeks ago but now it is not working I can't understand what is wrong in my code maybe it stopped working because of php update or there is other reason?

        $mail = trim(htmlspecialchars($conn->real_escape_string($_POST["mail"])));
        $subject  = "FULLBX.COM";
        $message  = '<h3>Account activation code: </h4> <h2 style="color:#ec5f06;">' . $tempCode . '</h3>';
        $header   = "From:support@fullbx.com \r\n";
        $header  .= "Cc:support@fullbx.com \r\n";
        $header  .= "MIME-Version: 1.0\r\n";
        $header  .= "Content-type: text/html\r\n";
        $mailsent = mail($mail,$subject,$message,$header);
        if (($mailsent)) {
            
            $_SESSION["tempcode"]  = $tempCode;
            $_SESSION["username"]  = $username;
            $_SESSION["mail"]      = $mail;
            $_SESSION["phone"]     = $phone;
            $_SESSION["pass"]      = $pass; 

        }else{
            echo "email is not sending please try again";
            exit();
        }

I always get "email is not sending please try again" error message

  • In such circumstances, I always run a tcpdump to see what, if anything, is being sent. – Bib Jul 24 '21 at 15:44
  • @Bib could you explain what is tcpdump and how can i run it please? – Tako Kobaxidze Jul 24 '21 at 15:47
  • You've not said what system you are on, Windows, Linux or other. tcpdump looks at the network traffic on the wire. If you are on Windows, look for wireshark. It will show you what packets are traversing the network, if any. Download, install and look at the docs. – Bib Jul 24 '21 at 15:51
  • Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – ADyson Jul 24 '21 at 16:23
  • the problem may be in extra whitespaces before \r\n in from: and cc: headers – Игорь Тыра Jul 24 '21 at 19:34

0 Answers0