Jump to content

Error when sending mail.


jwk811

Recommended Posts

Was trying to send a simple test email to my self.. I used this script...
[code]<?php$to = "(myemail)";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: [email protected]" . "\r\n" .
"CC: (myemail)";mail($to,$subject,$txt,$headers);
?>[/code]
And I uploaded it to the server and went to that page.. this was all that was displayed..
[quote]Parse error: parse error, unexpected T_VARIABLE in /home/content/j/w/k/jwk811/html/testemail.php on line 1
[/quote]
Does anyone know what this means or what I might of done wrong?
Link to comment
https://forums.phpfreaks.com/topic/22449-error-when-sending-mail/
Share on other sites

<?php
$name = $_POST["name"];
$email = $_POST["email"];
$info = $_POST["info"];
$to = "(myemail)";
$subject = "Info";
$message = "$name, $info";
$headers = "From: $email" . "\r\n" .
mail($to,$subject,$txt,$headers);
?>

does this look like its set up right because im having just little bit of trouble, if this is right it must be the form
[quote author=jwk811 link=topic=109914.msg443463#msg443463 date=1159497403]
ok and what would i add to the script to redirect to another page?
[/quote]
I assume you're wanting to thank the user for sending the email or something like that--that's what I think you meab by 'redirect to another page'.

header("Location:  thankyou.html");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.