1
mramsey
I need some help with $xoopsMailer
  • 2005/5/3 7:28

  • mramsey

  • Just popping in

  • Posts: 33

  • Since: 2002/3/8 3


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>

2
Mithrandir
Re: I need some help with $xoopsMailer

charSet is an attribute, not a method. And you are trying to add the attachment to the charset? Any particular reason for that?

try looking into $xoopsMailer->multimailer->addAttachment() (in /class/mail/phpmailer/class.phpmailer.php)

3
mramsey
Re: I need some help with $xoopsMailer
  • 2005/5/4 10:33

  • mramsey

  • Just popping in

  • Posts: 33

  • Since: 2002/3/8 3


Hi there,

I am not a PHP programmer, but I need to get this form working.

I've changed $xoopsMailer->charSet($attachment); to $xoopsMailer->multimailer->addAttachment(); but still the form does not send any attachment.

Could you please let know what do I have to add to the form to get it work?

Thanks.

Login

Who's Online

187 user(s) are online (120 user(s) are browsing Support Forums)


Members: 0


Guests: 187


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits