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 = "some-emil@gmail.com";
$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
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
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.