Skip to content

Instantly share code, notes, and snippets.

@kokh
Last active December 14, 2015 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kokh/5135674 to your computer and use it in GitHub Desktop.
Save kokh/5135674 to your computer and use it in GitHub Desktop.
<?php
require_once '/path_to_swift/lib/swift_required.php';
require_once 'SendEMail.php';
$sm = new SendEMail();
$recipients[0] = array(
'email' => 'onotole@blabla.com',
'user' => 'Onotole',
'something' => 'myalka',
'something_photo' => 'myalka.jpg',
'templateDir' => 'second_template'
);
$recipients[1] = array(
'email' => 'volodya@blabla.com',
'user' => 'Genade',
'something' => 'meshalka',
'something_photo' => 'meshalka.jpg',
'templateDir' => 'first_template'
);
$sm->templatesPath = "/path_to_templates";
$sm->emailFrom = 'noreply@site.com';
$sm->fromName = 'Site.com';
$count = 0;
foreach($recipients as $rec) {
$sm->varData = array(
'{user}' => $rec['user'],
'{something}' => $rec['something'],
'{something_photo}' => $rec['something_photo']
);
$sm->emailTo = $rec['email'];
$sm->toName = $rec['user'];
$sm->templateDirname = $rec['templateDir'];
if ($sm->Send())
$count++;
}
echo $count." email(-s) have been sent.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment