Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 48 lines (34 sloc) 1.12 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<?php
include("../IronCore.class.php");
include("../IronWorker.class.php");
include("../IronMQ.class.php");
$name = "MasterSlaveMailer-php";

$iw = new IronWorker('config.ini');

//parsing config to get token and project_id
$data = @parse_ini_file('config.ini', true);

//uploading worker
$iw->upload(dirname(__FILE__)."/workers/master_email_worker", 'MasterEmailWorker.php', $name);



$payload = array(
    'host' => 'smtp.gmail.com',
    'port' => 587,
    'username' => 'username',
    'password' => 'pass',
    'from' => 'from@mail.com',
    'token' => $data['iron_worker']['token'],
    'project_id' => $data['iron_worker']['project_id']
);

$ironmq = new IronMQ(array(
    'token' => $data['iron_worker']['token'],
    'project_id' => $data['iron_worker']['project_id']
));

//filing queue with emails
for ($i = 0; $i < 20;$i++) {
    $ironmq->postMessage('mail',$i.'sample@email.com');
}

$task_id = $iw->postTask($name, $payload);
echo "task_id = $task_id \n";

// Wait for task finish
$details = $iw->waitFor($task_id);
print_r($details);

$log = $iw->getLog($task_id);
echo "Task log:\n $log\n";


Something went wrong with that request. Please try again.