PHP code example of filippo-toso / eml-builder

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

    

filippo-toso / eml-builder example snippets


use FilippoToso\EmlBuilder\Address;
use FilippoToso\EmlBuilder\EmlBuilder;

$builder = (new EmlBuilder())
    ->from(Address::make('[email protected]', 'Acme Inc'))
    ->to(Address::make('[email protected]'))
    ->cc([Address::make('[email protected]'), Address::make('[email protected]', 'Acme Inc')])
    ->subject('Hello World!')
    ->text('This is the textual part of the email!')
    ->html('<h1>This is the HTML part of the email!</h1>');

// Get the EML content
$content = $builder->get();

// Save the EML content
$builder->save('test-email.eml');