PHP code example of buuum / mail
1. Go to this page and download the library: Download buuum/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/ */
buuum / mail example snippets
use Buuum\Mail;
use Buuum\MailerHandler\SwiftMailerHandler;
use Buuum\MailerHandler\PhpMailerHandler;
$config = [
'smtpsecure' => 'tls',
'host' => "smtp.host.com",
'username' => "host_username",
'password' => "host_password",
'port' => 25,
'from' => ['[email protected] ', 'WebName'],
'response' => ['[email protected] ', 'WebName'],
'spool' => true,
'spool_directory' => __DIR__ . '/spool'
];
// SWIFTHANDLER
$handler = new SwiftMailerHandler($config);
// PHPMAILER HANDLER
$handler = new PhpMailerHandler($config);
$mail = Mail::getInstance();
$mail->setHandler($handler);
$mail->subject('subject')->to('[email protected] ')->body('message body');
$mail->AddAttachment(__DIR__ . '/i.jpg', 'imagen.jpg');
$mail->AddAttachment("http://blog.caranddriver.com/wp-content/uploads/2015/11/BMW-2-series.jpg", 'car.jpg');
$mail->send();
$mail->subject('subject')->to('[email protected] ')->body('message body');
$mail->AddAttachment(__DIR__ . '/i.jpg', 'imagen.jpg');
$mail->AddAttachment("http://blog.caranddriver.com/wp-content/uploads/2015/11/BMW-2-series.jpg", 'car.jpg');
$mail->send(false);
$handler->sendSpooledMessages($messageLimit = 100, $timeLimit = 60);
$mails = [
'[email protected] ',
'[email protected] ',
'[email protected] '
];
$mail->subject('subject')->body('message body');
foreach($mails as $mail){
$mail->to($mail)->send();
}