Mail() function not working...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Limits
Forum Newbie
Posts: 2
Joined: Wed Jul 07, 2010 8:59 pm

Mail() function not working...

Post by Limits »

Hey guys, I'm currently writing a script that requires the mail() function and it's not working for me... I isolated my mail() code and it's still not working. Here's the code:

Code: Select all

<?php 

$subject = 'hello!';
$to = 'my@email.com';
$content = 'Hello World!';
$from = 'From: hello@test.com';

if(mail($to, $subject, $content, $from)) {
	echo "Success!";
} else {
	echo "failure";
}

?>
I've tried it both with and without the $from included in the additional headers param.
The page is always displaying "success" but there is no new mail in my inbox :/

Any ideas?
Thanks guys!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Mail() function not working...

Post by requinix »

Have you looked in your spam folder? Have you tried different email addresses? Have you checked the server for any mailing errors? Have you made sure that your sendmail daemon or equivalent is running and that its mail queue is empty?
Limits
Forum Newbie
Posts: 2
Joined: Wed Jul 07, 2010 8:59 pm

Re: Mail() function not working...

Post by Limits »

Thanks man, it's not the email addresses, so it must be a server/sendmail issue. I'll double check everything. Thanks! :D
Post Reply