PHP code example of t4web / mail

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

    

t4web / mail example snippets



return array(
    'modules' => array(
        // ...
        'T4web\Mail',
    ),
    // ...
);

't4web-mail' => [
    // Global for all mails
    'from-email' => '[email protected]',

    // Global for all mails
    'from-name' => 'Your project name',

    'templates' => [

        // Template id
        T4web\Mail\Template::FEEDBACK_ANSWER => [
            'subject' => 'Feedback answer',
            'template' => 't4web-mail/template/feedback-answer',
            'layout' => T4web\Mail\Template::LAYOUT_DEFAULT,
        ],
    ],

    'layout' => [

        // Layout id => layout template
        T4web\Mail\Template::LAYOUT_DEFAULT => 't4web-mail/layout/default',
    ],
],

$sender = $this->getServiceLocator()->get(\T4web\Mail\Sender::class);
$to = '[email protected]';
$data = [
    'userName' => 'Max',
    'message' => 'My message',
    'answer' => 'My answer',
];
$sender->send($to, \T4web\Mail\Template::FEEDBACK_ANSWER, $data);