PHP code example of nattreid / mailing
1. Go to this page and download the library: Download nattreid/mailing library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nattreid / mailing example snippets
class Mailer extends \NAttreid\Mailing\BaseMailer {
/**
* Odeslani linku pro zmenu hesla
* @param string $email
* @param string $hash
*/
public function sendRestorePassword($email, $hash) {
$mail = $this->createMail('template');
// nebo
$mail = $this->createMailFromString('<body><p>sablona jako string</p></body>);
$mail->link = $this->link('someLink', [
'hash' => $hash
]);
$mail->setSubject('translateMessage')
->addTo($email);
$mail->send();
}
/** @var \App\Services\Mailer @inject */
public $mailer;
$this->mailer->sendRestorePassword($email, $hash);