0

I'm trying to learn web development and right now I'm trying to do a contact form.

I couldn't get it to work so I googled it and found a page that said "Make sure php emailing even works. put this code in a new php file and open it"

    <?php
mail('mail1@mail.com','Test mail','The mail function is working!');
echo 'Mail sent!';
?>

I put my email into it and ran it. It prints the message on the web browser but when I check my email (inbox and spam folder) nothing is there.

How come I can't get these emails?

BreeBreeBRAN
  • 51
  • 1
  • 8
  • Do you have installed a Mail server like `Mercury`? If NOT installed and config one and come back if you still have a problem – Rizier123 Nov 15 '14 at 01:29
  • No. I've just been sending it to my yahoo email to see if it would even send. Is that why its not working? – BreeBreeBRAN Nov 15 '14 at 01:29
  • Simple question: You want to send a mail to mailadress xy. From where do you send it? ->You need a Mail server – Rizier123 Nov 15 '14 at 01:31

1 Answers1

1

Try this to see if it's actually even going through

<?php
    if (mail('mail1@mail.com','Test mail','The mail function is working!')) {
        echo 'Mail sent!';
    } else {
        echo 'failed';
    }
Meisam Mulla
  • 1,845
  • 3
  • 23
  • 37
  • The OP doesn't have a mail server installed. See the comments under OP's question if you haven't seen them already. We already know what the result will be; "`echo 'failed';`" – Funk Forty Niner Nov 15 '14 at 01:36