I'm using Laravel 4.2, IronMQ and Mailgun to send emails on the live site. For some reason two - sometimes three - copies of the email are being sent, about two minutes apart.
Mail::queue(
$templates,
$template_data,
function($message) use ($template, $parameters, $recipient) {
// Address the message.
$message->to( $recipient )
->subject( $parameters['subject'] );
// Add any additional recipients.
if ( isset($parameters['reply-to']) )
{
$message->replyTo( $parameters['reply-to'] );
}
if ( isset($parameters['cc']) )
{
$message->cc( $parameters['cc'] );
}
if ( isset($parameters['bcc']) )
{
$message->bcc( $parameters['bcc'] );
}
// Add any attachments to the email.
if ( isset($parameters['attach']) )
{
if ( is_array($parameters['attach']) )
{
foreach ($parameters['attach'] as $file)
{
$message->attach( $file );
}
}
else
{
$message->attach( $parameters['attach'] );
}
}
});
In my development environment I use sync for queuing, which doesn't appear to have the same issue.
My question is: how can I prevent the emails being sent more than once?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community