This is driving me nuts.
Downloaded and installed ZendFramework. Trying to send a DKIM signed mail but it is giving me this error(which i copied directly off their documentation).
Error: Fatal error: Uncaught Error: Using $this when not in object context in C:\xampp\htdocs\Project\send_form_email.php:12 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Project\send_form_email.php on line 12
// sign message with dkim
$signer = $this->getServiceLocator()->get('DkimSigner');
$signer->signMessage($mail);
What am I doing wrong here?
Edit: Added all coding
<?php
require 'vendor/autoload.php';
$mail = new \Zend\Mail\Message();
$mail->setBody("Test world!");
$mail->setFrom('noreplytest@sanscalc.co.za');
$mail->addTo('jr.swart49995@gmail.com');
$mail->setSubject('le subject');
// sign message with dkim
$signer = $this->getServiceLocator()->get('DkimSigner');
$signer->signMessage($mail);
// send message
$transport = new \Zend\Mail\Transport\Sendmail();
$transport->send($mail);
?>
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>