1
I have a job listing module and I've added an attachment to the form below to allow the users to send an email with attachment CV’s.
The form is working fine but I can not get any attachment with the email, I used $xoopsMailer->charSet but it doesn't work.
Could you please help me to know; what is my problem with this form? Why it doesn't send the attachment with the email?
Below in RED what I have been added to the form to allow attachment.
<?php
foreach ($_POST as $k => $v) {
${$k} = $v;
}
if ($submit) {
include("header.php");
global $xoopsConfig, $xoopsDB, $myts, $meta;
$result = $xoopsDB->query("select email, submitter, title, type, company, description, requirements FROM ".$xoopsDB->prefix("jobs_listing")." WHERE lid = '$id'");
while(list($email, $submitter, $title, $type, $company, $description, $requirements) = $xoopsDB->fetchRow($result)) {
$title = $myts->makeTboxData4Show($title);
$type = $myts->makeTboxData4Show($type);
$company = $myts->makeTboxData4Show($company);
$description = $myts->makeTboxData4Show($description);
$requirements = $myts->makeTboxData4Show($requirements);
$submitter = $myts->makeTboxData4Show($submitter);
if ($tele) {
$teles = ""._JOBS_ORAT." $tele";
} else {
$teles = "";
}
$message .= ""._JOBS_REMINDANN." $type : $title "._JOBS_FROMANNOF." $sitename\n";
$message .= ""._JOBS_MESSFROM." $namep $post ".$meta['title']."\n\n";
$message .= "\n";
$message .= stripslashes("$messtext\n\n");
$message .= " "._JOBS_ENDMESS."\n\n";
$message .= ""._JOBS_CANJOINT." $namep "._JOBS_TO." $post $teles \n\n";
$message .= "End of message \n\n";
$subject = ""._JOBS_CONTACTAFTERANN."";
$mail =& getMailer();
$mail->useMail();
//$mail->setFromName($meta['title']);
$mail->setFromEmail($post);
$mail->setToEmails($email);
$mail->setSubject($subject);
$mail->setBody($message);
$mail->send();
echo $mail->getErrors();
$message .= "\n".$_SERVER['REMOTE_ADDR']."\n";
$adsubject = $xoopsConfig['sitename']." Job Reply ";
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($xoopsConfig['adminmail']);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($adsubject);
$xoopsMailer->setBody($message);
$xoopsMailer->charSet($attachment);
$xoopsMailer->send();
}
redirect_header("index.php",1,_JOBS_MESSEND);
exit();
} else {
$lid = isset( $_GET['lid'] ) ? $_GET['lid'] : '' ;
include("header.php");
include(XOOPS_ROOT_PATH."/header.php");
OpenTable();
echo "<script type=\"text/javascript\">
function verify() {
var msg = \""._JOBS_VALIDERORMSG."\\n__________________________________________________\\n\\n\";
var errors = \"FALSE\";
if (document.cont.namep.value == \"\") {
errors = \"TRUE\";
msg += \""._JOBS_VALIDSUBMITTER."\\n\";
}
if (document.cont.post.value == \"\") {
errors = \"TRUE\";
msg += \""._JOBS_VALIDEMAIL."\\n\";
}
if (document.cont.tele.value == \"\") {
errors = \"TRUE\";
msg += \""._JOBS_VALIDTELE."\\n\";
}
if (document.cont.messtext.value == \"\") {
errors = \"TRUE\";
msg += \""._JOBS_VALIDMESS."\\n\";
}
if (errors == \"TRUE\") {
msg += \"__________________________________________________\\n\\n"._JOBS_VALIDMSG."\\n\";
alert(msg);
return false;
}
}
</script>";
echo "<b>"._JOBS_CONTACTAUTOR."</b><br /><br />";
echo ""._JOBS_TEXTAUTO."<br />";
echo "<form onsubmit=\"return verify();\" method=\"post\" action=\"contact.php\" name=\"cont\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$lid\" />";
echo "<input type=\"hidden\" name=\"submit\" value=\"1\" />";
if($xoopsUser) {
$idd =$xoopsUser->getVar("name", "E");
$idde =$xoopsUser->getVar("email", "E");
}
echo "<table width='100%' class='outer' cellspacing='1'>
<tr>
<td class='head'>"._JOBS_YOURNAME."</td>
<td class='even'><input type=\"text\" name=\"namep\" size=\"40\" value=\"$idd\" /></td>
</tr>
<tr>
<td class='head'>"._JOBS_YOUREMAIL."</td>
<td class='even'><input type=\"text\" name=\"post\" size=\"40\" value=\"$idde\" /></td>
</tr>
<tr>
<td class='head'>"._JOBS_YOURPHONE."</td>
<td class='even'><input type=\"text\" name=\"tele\" size=\"40\" /></td>
</tr>
<tr>
<td class='head'>"._JOBS_YOURMESSAGE."</td>
<td class='even'><textarea rows=\"5\" name=\"messtext\" cols=\"40\"></textarea></td>
</tr>
<tr>
<td class='head'>Attach your resume </td>
<td class='even'><input type=\"file\" name=\"attachment\" value=\"\" class=\'text_box\' size=\"20\"></td>
</tr>
</table>
<br />
<p><input type=\"submit\" value=\""._JOBS_SENDFR."\" /></p>
</form>";
CloseTable();
include(XOOPS_ROOT_PATH."/footer.php");
}
?>
<tr>