0

I dont know much about this stuff, so let me just say what is wrong and hopefully you guys wont kill me :P

I ve been having some problems with this simple php mail form, mainly with some emails disappearing randomly (i just don't receive them). I asked my hosting company to release the logs so i can see what is wrong. All they did was assure me that now everything should work, but it doesn't and its kinda all they did.

So now i was thinking maybe there is a way to add an extra line to my code where i can add a specific email address created by me? This way I will be able to controll everything that happends with logs and stuff.

  <?php
        $wiadomosc = 
            "Imie i nazwisko: ".$_POST['nick']." 
        Adres e-mail: ".$_POST['mail']." 
        Tytuł: ".$_POST['tytul']." 
        Treść wiadomości: ".$_POST['info']." "; 
        $tematyka = "Formularz kontaktowy".$temat;

        mail ("myemail@example.eu", $tematyka, $wiadomosc ); 
    ?>
  • 1
    Please ensure correct syntax highlighting and post the code as one block. Mark all your code and press {} button in edit form. – Nicolas Heimann Feb 07 '16 at 14:12

1 Answers1

0

There are several causes of the e-mails not being received at the destination. I would start by checking mail return value. Also, double check Spam or similar folder.

More details about troubleshooting this problem can be found here.

I should also make sure to use SMPT authentication, as e-mails without authentication have a good chance of being treated as spam (e.g. it is important to send e-mails from the domain your sender e-mail belongs to). I have used PHPMailer and it worked without problems. An example of its usage can be found here.

Community
  • 1
  • 1
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164