PHP code example of slm / mail

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

    

slm / mail example snippets


$message = new \Zend\Mail\Message();

// This will be considered as plain text message, even if the string is valid HTML code
$message->setBody('Hello world');

$message = new \Zend\Mail\Message();

$htmlPart = new \Zend\Mime\Part('<html><body><h1>Hello world</h1></body></html>');
$htmlPart->type = "text/html";

$textPart = new \Zend\Mime\Part('Hello world');
$textPart->type = "text/plain";

$body = new \Zend\Mime\Message();
$body->setParts(array($textPart, $htmlPart));

$message->setBody($body);

'slm_mail' => array(
        // Here your email service provider options

        'http_adapter' => 'Zend\Http\Client\Adapter\Proxy' // for example
    )

'slm_mail' => array(
        // Here your email service provider options

        // example for Socket adapter
        'http_options' => array(
            'sslverifypeer' => false,
            'persistent' => true,
        ),
    )

curl -s http://getcomposer.org/installer | php
php composer.phar install