PHP code example of delboy1978uk / bone-mail

1. Go to this page and download the library: Download delboy1978uk/bone-mail 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/ */

    

delboy1978uk / bone-mail example snippets




// use statements here
use Bone\Mail\MailPackage;

return [
    'packages' => [
        // packages here...,
        MailPackage::class,
    ],
    // ...
];



// the docker dev box uses these Mailhog settings
return [
    'mail' => [
        'name' => 'mail', // or 127.0.0.1 etc
        'host' => 'mail', // or localhost etc
        'port' => 1025, // or 25
    ],
];

$mailService = $c->get(MailService::class);

$mail = new EmailMessage();
$mail->setTo($email);
$mail->setSubject($subject);
$mail->setTemplate('email.user::user_registration/change_email');
$mail->setViewData([
    'siteUrl' => $env->getSiteURL(),
    'logo' => $this->getSiteConfig()->getEmailLogo(),
    'resetLink' => '/user/reset-email/' . $email . '/' . $newEmail . '/' . $token,
]);
$this->mailService->sendEmail($mail);