Jump to content

Simple email error


3raser

Recommended Posts

Code:

 

<?php

$to = $_POST['to'];
$title = $_POST['title'];
$message = $_POST['message'];
$email = $_POST['from'];

mail('$to',  '$title', '$message', 'From: $email);

echo "Email sent to $to from $email, with the title $title.";

?>

 

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/a9726309/public_html/emailed.php on line 8

Link to comment
https://forums.phpfreaks.com/topic/180017-simple-email-error/
Share on other sites

try this

<?php

$to = $_POST['to'];
$title = $_POST['title'];
$message = $_POST['message'];
$email = $_POST['from'];

if(mail($to,  $title, $message, "From: $email")){
   echo "Email sent to $to from $email, with the title $title.";
}else{
   echo "Email Failed";
}

?>

 

Note: variables inside single quotes wont get parsed

Link to comment
https://forums.phpfreaks.com/topic/180017-simple-email-error/#findComment-949719
Share on other sites

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.