Jump to content

php email form


newbie79

Recommended Posts

I'm trying to make an email form work.  I get a syntax error as follows Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Users/nlnewbr/Sites/testdontbankit/tmessageSent.php on line 5

 

Is this the correct code?

 

<?php

$to = "xxx@yahoo.com";

$reply_message_subject = $_POST['subject'];

$reply_message_body = $_POST['body'];

$config_mailheaders="From:xxx@yahoo.com";

 

$reply_body=<<<_MAIL_

$reply_message_name = $_POST['name'];

$reply_message_address = $_POST['address'];

$reply_message_phoneno = $_POST['phoneno'];

$reply_message_body

 

_MAIL_;

 

mail($to,$reply_subject,$reply_body,$config_mailheaders)}

?>

 

Thanks for your help!

 

Link to comment
Share on other sites


//set up the mail variables
$subject= $_POST['subject']
$name = $_POST['name'];
$address = $_POST['address'];
$phoneno = $_POST['phoneno'];


  $recipient  = "XXX@yahoo.com";
  $subject    = "$subject";
  $msg        = "Name: $name";
  $msg     .="Address: $address";
  $msg     .="Phoneno: $phoneno";
  $mailheader = "From:webmaster@yourdomain.com <YourDomain.com>\n";
  $mailheader .= "Return-Path: <webmaster@yourdomain.com>\n";


// all variables set up, mail the  contents...
       
  mail($recipient,$subject,$msg,$mailheader);

 

try this. Shoukld work. Make sure you put in YOUR info for return path and recipiant

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.