Forum Moderators: coopster

Message Too Old, No Replies

PHP Email Error

         

tlsarna

1:22 am on Apr 16, 2007 (gmt 0)

10+ Year Member



HI ... I am trying to write the most simple script to email a reminder to people. The plan was to set up a Cron job, once I got the script to work - but I can't get the script to work at all. I'm new at PHP, so go easy ... I found the script on the 'Net ... Here's the error that I get:

syntax error, unexpected T_STRING in /home/.patch/myusername/mydomain/my.php on line 2.

Here's the script:
<?php
$to = "tlsarna@example.org";
$subject = "Reminder Message - Example Production Arts Team Service This Weekend!";
$body = "REMINDER: You are scheduled to serve on the Production Arts team this weekend! If you are unavailable to serve, please contact a replacement or send an email to example@example.org.\nTo check this week's schedule, login here: http://www.example.com/pages/pa/thiswk.shtml. If you are unable to login, please contact First Name/Last Name at webmistress@example.com with your desired password, so that she can set you up with access.\n\nThanks for your service, and God bless!";
mail($to, $subject, $body)
?>

[edited by: coopster at 2:58 am (utc) on April 16, 2007]
[edit reason] exemplified details [/edit]

capulet_x

4:08 am on Apr 16, 2007 (gmt 0)

10+ Year Member



Modify this script to suit you and let us know if it works.

<?php
$to = "joe@examplel.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

capulet_x

4:17 am on Apr 16, 2007 (gmt 0)

10+ Year Member



Try this too....

change this:

mail($to, $subject, $body)

to this
(add semicolon):

mail($to, $subject, $body);