Forum Moderators: coopster
I cant seem to get my script to send the email in the code below. The whole code gets processed ok and gets no errors, database info gets stored, it just wont send the email.
I assume its not remembering the $CompanyEmail variable.
Can anyone help?
// Show errors, if any
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);// Recieving variables from send-test.php
$CompanyEmail = $_POST['CompanyEmail'];
$CompanyName = $_POST['CompanyName'];
$job_id = $_POST['job_id'];
$position = $_POST['position'];
$ename = $_POST['ename'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];
$zip = $_POST['zip'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$phone2 = $_POST['phone2'];
$job_seeker_email = $_POST['job_seeker_email'];
$cover_letter = $_POST['cover_letter'];
$CV_name = $_FILES['CV']['name'];
$CV_tmp_name = $_FILES['CV']['tmp_name'];
$date = $_POST['date'];
?>
<?php
/* the name of the folder - change to fit your needs */
$folder = "cvs/";
//First you move uploaded file into folder
move_uploaded_file($CV_tmp_name,$folder.$CV_name);
//Inserting data into the database
$q = "insert into applications set
date = '$date',
job_id = '$_POST[job_id]',
position = '$_POST[position]',
emp_uname = '$ename',
CompanyName = '$CompanyName',
CompanyEmail = '$CompanyEmail',
job_uname = '$uname',
first_name = '$fname',
last_name = '$lname',
address = '$address',
city = '$city',
state = '$state',
zip = '$zip',
phone = '$phone',
phone2 = '$phone2',
job_seeker_email = '$job_seeker_email',
cover_letter = '$cover_letter',
cv = '$CV_name'
";
$r = mysql_query($q) or die(mysql_error());
$CompanyEmail = '$CompanyEmail';
// Notify the employer by email
$to = "$CompanyEmail";
/* subject */
$subject = "New job applicant from Work In Cairns";
/* message */
$message =
"
\n
A JobSeeker has applied for your job vacancy on Work In Cairns.\n\n
Position - $position\n\n
Job ID - $job_id\n\n\n\n
Name - $fname $lname\n\n
Contact Person - $contact_name\n\n
To view the applicant`s resume, please login to www.example.com using your username/pass.\n
On the Employers Menu, click Manage Jobs.\n\n
Then just click on the link \"view applicants list\" for the relevant job offer.\n\n\n
Thank you for using Work In Cairns\nhttp://www.example.com
";
/* and now mail it */
mail($to, $subject, $message);
echo "<br><br><font face='Trebuchet MS' size='2' color='#000099'>
<b>Thank you $fname</font></b>
<br><font face='Trebuchet MS' size='2' color='black'>
Your application has been successfully sent to $CompanyName.
<br><br><br>
<a href='http://www.example.com/jobseekers/index.php'><font face='Trebuchet MS' size='2' color='#000099'>Click Here</font></a> to go back to the home page.
<br><br>";
?>
[edited by: jatar_k at 4:43 pm (utc) on Sep. 6, 2005]
[edit reason] examplified [/edit]