Forum Moderators: coopster

Message Too Old, No Replies

Sending email - wont send?

         

adammc

1:21 am on Sep 6, 2005 (gmt 0)

10+ Year Member



Hi,

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]

jatar_k

7:04 pm on Sep 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you sure that it isn't sending it or is it not being received? Those are 2 very different things. Are you sure it isn't getting filtered or just plain burned on the receiving end?

Stooshie

4:07 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Have you sent email from php on the same box before? It may be that it can't connect to the SMTP server (you can change the settings in one of php's config/ini files. Sorry, can't remember where off the top of my head).

jatar_k

5:33 pm on Sep 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



another thing to try is to handle errors on the mail function

$diditgo = mail($to, $subject, $message);
if (!$diditgo) echo 'mail function died';

adammc

11:29 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Thanks guys, I got it sorted