PHP code example of molajo / email

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

    

molajo / email example snippets



    // 1. Instantiate an Email Handler.
    $options                     = array();
    $options['mailer_transport'] = 'mail';
    $options['site_name']        = 'Sitename';
    $options['Fieldhandler']     = new Fieldhandler();

    $class   = 'Molajo\\Email\\Handler\\PhpMailer';
    $handler = new $class($options);

    // 2. Instantiate the Adapter, injecting it with the Handler.
    $class         = 'Molajo\\Email\\Adapter';
    $this->adapter = new $class($handler);

    // 3. Set email parameters
    $this->adapter->set('to', '[email protected],Fname Lname');
    $this->adapter->set('from', '[email protected],Fname Lname');
    $this->adapter->set('reply_to', '[email protected],FName LName');
    $this->adapter->set('cc', '[email protected],FName LName');
    $this->adapter->set('bcc', '[email protected],FName LName');
    $this->adapter->set('subject', 'Welcome to our Site');
    $this->adapter->set('body', 'Stuff goes here');
    $this->adapter->set('mailer_html_or_text', 'text');

    // 4. Send Email.
    $this->adapter->send();


    curl -s https://getcomposer.org/installer | php

{
    "  "Molajo/Email": "1.*"
    }
}

    php composer.phar install