Jump to content

PHP Emailer Help "error"


perezf

Recommended Posts

I am recieving an error everytime i add this to my page.

the error is "i have modified the code below to keep what site it is private

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in on line 44Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 44

 

<?php
if($_POST['Submit'] && isset($_POST['email']) && isset($_POST['comments']))
{
$to = "[email protected]";
$subject = $_POST['who'];
$body = $_POST['comments'];
$from = "From: ".$_POST['email'];

mail($to,$subject,$body,$from) 
	echo "<p>Your Message has been Sent!</p>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/38752-php-emailer-help-error/
Share on other sites

Here try this..

 

<?php

/* recipients */ $recipient .= "[email protected]";
/* subject */
$subject = "Checking PHP mail";
/* message */
$message .= "This is a test mail \n";
/* you can add a stock signature */
$message .= "-\r\n"; //Signature delimiter
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: The great webmaster \n";
$headers .= "To-Sender: \n";
$headers .= "X-Mailer: PHP\n"; // mailer
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: \n"; // Return path for errors

/* If you want to send html mail, uncomment the following line */ 

// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type 
$headers .= ""; // CC to 
$headers .= ""; // BCCs to 
/* and now mail it */
mail($recipient, $subject, $message, $headers);

?>

 

And if it doesnt work then you might not  be able to send email from your server. Although I highly doubt that.

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.