Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get log or email #67

Closed
karneaud opened this issue Oct 6, 2018 · 1 comment
Closed

Unable to get log or email #67

karneaud opened this issue Oct 6, 2018 · 1 comment

Comments

@karneaud
Copy link

karneaud commented Oct 6, 2018

I have the following being executed on a cron job every minute

$scheduler = new GO\Scheduler([
    'email' => [
        'subject' => 'Hourly Email History From Attendee Scheduler',
        'from' => ADMIN_EMAIL,
        'body' => 'This is the daily visitors count',
        'transport' => $transport,
        'ignore_empty_output' => true,
    ]
]);

$scheduler->call(
  function($run, $per_minute, $trottle) use ($emailer, $logger) {
    if($emailer->sendAttendeeEmails($run, $per_minute, $trottle) == -1)
    {
      trigger_error(sprintf('These emails failed to send %s' , join(',', $emailer->get_failed())),  E_USER_WARNING);
    }

    echo "Total emails send {$emailer->get_sent()}";
    echo "{$logger->dump()}";
  },
  [
    $NUM_EMAIL_PER_RUN,
    $EMAILS_PER_MINUTE,
    $NUM_SECS_PAUSE_RUN
  ],
  'SchedulerEmail'
  )->at("*/2 * * * *")->output('run.log')->email([
    [
         'themegastore_admin@smsmail.net' => 'Admin Store'
    ],
    'themegastore@smsmail.net'
]);
// Let the scheduler execute jobs which are due.
$scheduler->run();

The above code uses SwiftMailer to execute batch emails every 2 minutes then email and save to a file. While the job runs as expected I get neither an email nor an output file

I'm running PHP 7.0.32 using 2.*

Is it that I cannot run both or is there something else I'm missing here

UPDATE

I'm able now get the logs but not the emails

peppeocchi added a commit that referenced this issue Oct 8, 2018
@peppeocchi
Copy link
Owner

@karneaud I see the issue, the documentation is wrong you should provide your email addresses on a single array, so instead of

->email([
    [
         'themegastore_admin@smsmail.net' => 'Admin Store'
    ],
    'themegastore@smsmail.net'
]

it should be

->email([
     'themegastore_admin@smsmail.net' => 'Admin Store',
    'themegastore@smsmail.net'
]

Please let me know if that solves your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants