PDA

View Full Version : PHP - Scripts can't email?



lolwut
20-01-2008, 09:49 PM
Right well, I've tryed everything to make a mailer script I've made work, but it just wont.
Here's my code:


<?php
$to = "[email protected]";
$subject = "Testinggggg";
$message = "Hey!\nTest mail innit.";
$headers = "From: Tanzim.org <[email protected]>";

mail($to,$subject,$message,$headers);

echo("Message headed " . $subject . " was sent to " . $to . ".");
?>
I go to my webmail account thingy ([email protected]) and there's nothing in the inbox.

Is there some setting I need to change in cPanel for mail() to work?

+Reps to any help atall.

Florx
20-01-2008, 10:08 PM
Get your host to check if there are any bounces or check spam if you have a spam folder.

Else php.net and search mail(). Good luck.

Jme
20-01-2008, 10:17 PM
i think you need to visit the page and run the script..?

Jackboy
21-01-2008, 09:01 AM
Get your host to check if there are any bounces or check spam if you have a spam folder.

Else php.net and search mail(). Good luck.

I think hes right ^ Most "tester" emails appear in spam

Hypertext
21-01-2008, 03:01 PM
make sure your host is set to Linux, my windows host didnt support php but yours may

Chippiewill
22-01-2008, 01:13 PM
The hostwill almost def have php Your Host may not have email enabled or the isp might not allow it. Contact your host and ask.

Blob
22-01-2008, 06:29 PM
The hostwill almost def have php Your Host may not have email enabled or the isp might not allow it. Contact your host and ask.

I highly doubt an ISP will stop you sending email.

QuickScriptz
23-01-2008, 01:14 AM
The hostwill almost def have php Your Host may not have email enabled or the isp might not allow it. Contact your host and ask.

Um no they wouldn't.... very likely not if he has a Windows Hosting Package. It is actually not that rare to find someone who has Windows Hosting who doesn't even know the difference and Windows was cheaper or something - so if you don't already know then just double check you're using Linux Hosting.


I highly doubt an ISP will stop you sending email.

He's quite right, unless the ISP has like blocked your server in your specific datacentre then that's highly unlikely.

Generally speaking the best way to tell is to make a file and then insert the following code and visit it in your browser. Scroll down till you find the bit about PHP sendmail or just mail().



<?php
echo phpinfo();
?>

Want to hide these adverts? Register an account for free!