PHP code example of italix / mail

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

    

italix / mail example snippets


$result = $mailer->send(
    (new Message())
        ->to($customer->email, $customer->name)
        ->subject($t->get('mail.invoice.subject'))
        ->view('mail/invoice', ['invoice' => $invoice])
        ->context('invoice ' . $invoice_id)
);

if (!$result->is_sent()) {
    // error_code(): transport | auth | recipient_rejected | timeout | throttled
    // log_id()  : the row already written, with the server's own reply
}

final class ViewBodies implements BodyRenderer
{
    public function render(string $path, array $data): string
    {
        return $this->view->render($path, $data);
    }
}
bash
php src/Libs/Italix/Mail/tests/MessageTest.php
php src/Libs/Italix/Mail/tests/MailerTest.php    # the log half needs ITALIX_TEST_DSN