PHP code example of mecanik / zf3mail

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

    

mecanik / zf3mail example snippets



return [
   'zf3mail_config' => [
       'smtp_login' => [
           'name' => 'smtp.hostname.net',
           'host' => 'smtp.hostname.net',
           'connection_class' => 'login',
           'connection_config' => [
               'username' => '',
               'password' => '',
               'ssl' => 'tls',
           ],
       ],
       
       // By default, the Message class assumes ASCII encoding for your email. I've set UTF-8, but change as neccessary.
       'encoding' => 'UTF-8',
       
       // Default layout used for all HTML emails. This can be replaced per email basis by specifying 'layout' array parameter when composing emails.
       'default_layout' => 'application/emails/default_layout.phtml',
   ],
];


$headers = [      
   'from' => 'My Name <[email protected]>',
   'subject' => 'Hello there',
   'to' => 'Neo <[email protected]>',
   // Additional headers can be specified like:
   // 'X-API-Key', 'FOO-BAR-BAZ-BAT'
];

$template = [
   'content_template' => 'application/emails/order-received.phtml',
   //'layout' => 'application/emails/layout.phtml',
];

$email = $this->zf3mail()->compose($headers, $template, $parameters);

  echo $this->email_content 

$this->zf3mail()

$this->zf3mail()

$this->zf3mail()->send($email);