PHP code example of stackinstance / mailer-bundle

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

    

stackinstance / mailer-bundle example snippets


/**
 * @Route("/mail", name="mail")
 */
public function mailAction()
{
    $mailer     = $this->container->get('stack_instance.mailer');
    $attachment = new Attachment();

    $attachment->attach('/path/to/file/test.csv', 'file.csv', 'text/csv');

    $mailer->send('This is my subject', 'This is the body', '[email protected]', '[email protected]', '[email protected]', '[email protected]', $attachment);
}