Sending e-mail frontend form
I m having some trouble with sending a frontend mail with the new mailer. For some reason it doesnt get mailed ...
This is the code i m running for the moment:
// no errors?
if ($this->frm->isCorrect())
{
// reformat data
$naam = $this->frm->getField('naam')->getValue();
$voornaam = $this->frm->getField('voornaam')->getValue();
$straatnr = $this->frm->getField('straatnr')->getValue();
$gemeente = $this->frm->getField('gemeente')->getValue();
$postcode = $this->frm->getField('postcode')->getValue();
$nationaliteit = $this->frm->getField('nationaliteit')->getValue();
$email = $this->frm->getField('email')->getValue();
$fullName = $voornaam.' '.$voornaam;
// mailValues
$subject = 'Sollicitatie';
// mail data to contact e-mail in Fork settings
$message = \Common\Mailer\Message::newInstance($subject)
->setFrom(array($email => $fullName))
->setTo(array(bram@bubblefish.be => Bubblefish webdesign))
->setReplyTo(array($email => $fullName))
->parseHtml(
FRONTEND_MODULES_PATH . '/Jobs/Layout/Templates/Mails/Apply.tpl'
)
;
$this->get('mailer')->send($message);
}
I m getting the values from the submit files, set them as recipient and sender. The apply.tpl file is present but nog content in it yet. How to fix this?
You might want to change this line:
->setTo(array(bram@bubblefish.be => Bubblefish webdesign))
To this line:
->setTo(array('bram@bubblefish.be' => 'Bubblefish webdesign'))
thx. I got it running. kindq forgot to call the function in my execute.