TheBigK
Well-known member
I'm trying to create my own 'Contact Us' page, and obviously; most of my code matches with that of the existing code. I'm however unable to get it to run fine.
Debugging shows that 'getPreparedMailHandler' is returning 'false' and I've no clue what's there that's failing. The actual error I'm getting is this:-
Fatal error: Call to a member function setReplyTo() on boolean in /Applications/MAMP/htdocs/xf/library/ContactUs/ControllerPublic/Index.php on line 69
The line 69 is: $mailObj ->setReplyTo($replyTo, $replyName);
Debugging shows that 'getPreparedMailHandler' is returning 'false' and I've no clue what's there that's failing. The actual error I'm getting is this:-
Fatal error: Call to a member function setReplyTo() on boolean in /Applications/MAMP/htdocs/xf/library/ContactUs/ControllerPublic/Index.php on line 69
The line 69 is: $mailObj ->setReplyTo($replyTo, $replyName);
PHP:
//Build arguments for $mailObj
$toEmail = 'me@mydomain.com'; //This will later be updated to support department email IDs
$toName = 'MyWebsite';
$headers = array('Sender' => 'me@mydomain.com');
$fromMail = 'me@mydomain.com';
$fromName = 'MyWebsite';
$mailObj = $mail->getPreparedMailHandler($toEmail, $toName, $headers, $fromMail, $fromName);
$replyTo = $contactEmail;
$replyName = $contactName;
$mailObj->setReplyTo($replyTo, $replyName);
$mail->sendMail($mailObj);
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->getDynamicRedirect(),
new XenForo_Phrase('your_message_has_been_sent')
);