Forum Moderators: coopster

Message Too Old, No Replies

PHP Mail Function

         

shimeal

5:24 am on May 30, 2004 (gmt 0)

10+ Year Member



Hey Everyone,

I am receiving an error (unexpected T_Variable) with this piece of code. Any suggestions on how to improve this code to make it work correctly would be greatly appreciated!

<?php
$submit_email = $_POST['submit_email']
$mailContent = "Thank you for joining the Newsletter!\n".
."Your email address, ".$submit_email." has been added to our records.\n"
."Thanks again!\n\n"
."Your friends at exampleUSA\n"
$toAddress="exampleUSA.com";
$subject="Your Newsletter Subscription";
mail($submit_email, $subject, $mailContent,"From: subscriptions@$toAddressnReply-To: recycle@$toAddress");
?>

Thanks!

BDC

[edited by: jatar_k at 4:48 pm (utc) on May 30, 2004]
[edit reason] generalized [/edit]

ProductivePC

6:20 am on May 30, 2004 (gmt 0)

10+ Year Member



You have 3 syntax errors in there that are causing your error.

On line line 2 there is no semi-colon ;
On line 3 there is an extra .
On line 7 there is no semi-colon ;

Below should work for you as long as you set it up with your SMTP.

<?php
$submit_email = $_POST['submit_email']
$mailContent = "Thank you for joining the Newsletter!\n".
."Your email address, ".$submit_email." has been added to our records.\n"
."Thanks again!\n\n"
."Your friends at example USA\n"
$toAddress="exampleUSA.com";
$subject="Your Newsletter Subscription";
mail($submit_email, $subject, $mailContent,"From: subscriptions@$toAddressnReply-To: recycle@$toAddress");
?>

Hope it helps

Wayne

[edited by: jatar_k at 4:49 pm (utc) on May 30, 2004]
[edit reason] generalized and removed sig [/edit]