Hi all,
Could someone please help me out? I have quite a bit of programming experience in a number of languages, but am new to PHP, and can't figure out why this VERY SIMPLE php email script won't work!!! So frustrating, it just returns a blank screen, which I assume means a syntax error?
Code:
<?php
$to = "me@me.com";
$subject = "dummy subject";
$body = "dummy body";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
Thanks to anyone who can help me out!!
t
Beginning PHP
Moderator: General Moderators
Re: Beginning PHP
I can't see anything obviously wrong with the code, though I haven't parsed it.
Have you got error reporting on? viewtopic.php?f=1&t=21400
Have you got error reporting on? viewtopic.php?f=1&t=21400
-
count_spacula
- Forum Newbie
- Posts: 3
- Joined: Thu Aug 13, 2009 5:18 am
Re: Beginning PHP
Hey, thanks for your help.
Downloaded the PHP environment, and it should work fine. I have posted the above PHP script to my website on my contact form, just to check the script, but I dont receive the email the script dictates. Is there soe special process I have to go through to make it work. The web server is definitely PHP enabled.
Thanks,
Tom
Downloaded the PHP environment, and it should work fine. I have posted the above PHP script to my website on my contact form, just to check the script, but I dont receive the email the script dictates. Is there soe special process I have to go through to make it work. The web server is definitely PHP enabled.
Thanks,
Tom
-
mars_rahul
- Forum Newbie
- Posts: 12
- Joined: Thu Aug 06, 2009 12:22 am
Re: Beginning PHP
Instead of the line below better use email address of Hotmail, Gmail, or yahoo. Also check junk messages also.
$to = "me@me.com";
This email address may be wrong and all the script you have written is correct.
Thanks,
$to = "me@me.com";
This email address may be wrong and all the script you have written is correct.
Thanks,
-
count_spacula
- Forum Newbie
- Posts: 3
- Joined: Thu Aug 13, 2009 5:18 am
Re: Beginning PHP
Thanks for your help.
The PHP should work, but I never end up receiving the email when I click the submit button on the form. The PHP is definitely being triggered, but i don't get why it doesnt send me the mail!!! ARGGGHH!!!
Please helpme, you will be a life saver,
T
The PHP should work, but I never end up receiving the email when I click the submit button on the form. The PHP is definitely being triggered, but i don't get why it doesnt send me the mail!!! ARGGGHH!!!
Please helpme, you will be a life saver,
T
-
mars_rahul
- Forum Newbie
- Posts: 12
- Joined: Thu Aug 06, 2009 12:22 am
Re: Beginning PHP
Please check configuration of web server for email -> php.ini files
That will be the other reason
That will be the other reason