PHP code example of xepan / mail

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

    

xepan / mail example snippets


use Nette\Mail\Message;

$mail = new Message;
$mail->setFrom('John <[email protected]>')
	->addTo('[email protected]')
	->addTo('[email protected]')
	->setSubject('Order Confirmation')
	->setBody("Hello, Your order has been accepted.");

use Nette\Mail\SendmailMailer;

$mailer = new SendmailMailer;
$mailer->send($mail);

$mail->setFrom('[email protected]');
$mail->setFrom('[email protected]', 'John Doe');
$mail->setFrom('John Doe <[email protected]>');

$mail->setHTMLBody('<b>Sample HTML</b> <img src="background.gif">');

$mail->addAttachment('example.zip');

$mailer = new Nette\Mail\SmtpMailer(array(
        'host' => 'smtp.gmail.com',
        'username' => '[email protected]',
        'password' => '*****',
        'secure' => 'ssl',
));
$mailer->send($mail);