Jump to content

email problem


jobs1109

Recommended Posts

Hi ,

 

I have a form were users fill out an email from then goes to second page but email does not get sent .

When I print out the variables it prints out fine. Here is the code. What am I doing wrong ?

 



<?php
$_POST['Name']    = $_SESSION['Name']; 
$_POST['Email']      = $_SESSION['Email'];
$_POST['Message']      = $_SESSION['Message'];
$_POST['Email_Subject']      = $_SESSION['Email_Subject'];

$to = "[email protected]";
$Name = $_POST['Name'];
$Email = $_POST['Email'];
$Message = $_POST['Message'];
  mail($to,$Name,$Email,$Message);

echo $to;
echo $Name;
echo $Email;
echo $Message;
echo $headers;
echo "Mail Sent.";
?> 



Link to comment
https://forums.phpfreaks.com/topic/243168-email-problem/
Share on other sites

What were you attempting to do with this?

$_POST['Name']    = $_SESSION['Name']; 
$_POST['Email']      = $_SESSION['Email'];
$_POST['Message']      = $_SESSION['Message'];
$_POST['Email_Subject']      = $_SESSION['Email_Subject'];

 

also, the mail() function takes in the following parameters, in this order:

mail(destinationEmail, Subject, Message, Headers);

you're using:

mail($to,$Name,$Email,$Message);

 

and... this:

echo $to;
echo $Name;
echo $Email;
echo $Message;
echo $headers;
echo "Mail Sent.";

is just going to print out a string without any line breaks or spaces between values, and also throw an undefined error (since $headers doesn't exist in your script)

Link to comment
https://forums.phpfreaks.com/topic/243168-email-problem/#findComment-1248960
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.