I am trying to add fileds in phpmailer() in jobbersbase.
but i am not getting how to add it properly
i am using like this, but it is mailing only $mailer->Body = ($data['apply_location1']);, i mean the one just above the $mailer->AltBody = $msg; statement. but i want to send all the info through mail.
public function MailApplyOnline($data)
{
$mailer = $this->getConfiguredMailer();
$subject = $this->emailTranslator->GetApplyOnlineSubject($data);
$msg = $data['apply_msg'];
$msg .= $this->emailTranslator->GetApplyOnlineMsg($_SERVER['HTTP_REFERER']);
$mailer->SetFrom($data['apply_email'], $data['apply_name']);
$mailer->AddAddress($data['company_email'], $data['company_name']);
$mailer->Subject = $subject;
$mailer->Body = $this->nl2br($msg);
$mailer->Body = ($data['apply_company']);
$mailer->Body = ($data['apply_contact']);
$mailer->Body = ($data['apply_title']);
$mailer->Body = ($data['apply_location']);
$mailer->Body = ($data['apply_location1']);
$mailer->AltBody = $msg;
if ($data['attachment_filename'] != '')
{
$mailer->AddAttachment($data['attachment_path'], $data['attachment_filename']);
}
if ($mailer->Send())
{
return true;
}
else
{
return false;
}
}
Create a local variable $body and keep appending whatever you need to add for the body content.
$body = "";
$body .= $this->nl2br($msg) . "<br/>";
$body .= ($data['apply_company']) . "<br/>";
$body .= ($data['apply_contact']) . "<br/>";
$body .= ($data['apply_title']) . "<br/>";
$body .= ($data['apply_location']) . "<br/>";
$body .= ($data['apply_location1']) . "<br/>";
$mailer->Body = $body;
The reason your code fails is because you keep overwriting $mailer->Body.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.