PHP code example of mj-zana / communication

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

    

mj-zana / communication example snippets


// config/mail.php
return [
    'dsn' => 'smtp://user:[email protected]:587',   // memory:// records instead (the default)
    'from' => ['address' => '[email protected]', 'name' => 'Example'],
    'reply_to' => '[email protected]',               // optional default Reply-To
];

$mailer->send(Message::create()
    ->to('[email protected]')
    ->replyTo($visitor->email)
    ->subject('New message from the website')
    ->text($body));

$recorder = $container->get(MailRecorder::class);
$this->assertCount(1, $recorder->sent(fn (Message $m): bool => $m->subject === 'Welcome'));