PHP code example of lijinhua / hyperf-mailer
1. Go to this page and download the library: Download lijinhua/hyperf-mailer 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/ */
lijinhua / hyperf-mailer example snippets
declare(strict_types=1);
namespace App\Mail;
use Lijinhua\HyperfMailer\Contract\ShouldQueue;
use Lijinhua\HyperfMailer\Mailable;
use Lijinhua\HyperfMailer\Mail;
class TestEmail extends Mailable implements ShouldQueue
{
public function __construct(private string $name)
{
}
public function build(): void
{
$this
->subject('PHP Department welcome')
->textBody(sprintf('Hello, %s!', $this->name));
}
}
...
Mail::to("[email protected]")->queue(new TestEmail('xxx'));
shell script
php bin/hyperf.php vendor:publish lijinhua/hyperf-mailer