{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/9881","labels_url":"https://api.github.com/repos/laravel/framework/issues/9881/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/9881/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/9881/events","html_url":"https://github.com/laravel/framework/issues/9881","id":99787324,"number":9881,"title":"[L4.2] Mail keeps sending older message, queue job not receiving correct payload?","user":{"login":"georgeboot","id":884482,"avatar_url":"https://avatars.githubusercontent.com/u/884482?v=3","gravatar_id":"","url":"https://api.github.com/users/georgeboot","html_url":"https://github.com/georgeboot","followers_url":"https://api.github.com/users/georgeboot/followers","following_url":"https://api.github.com/users/georgeboot/following{/other_user}","gists_url":"https://api.github.com/users/georgeboot/gists{/gist_id}","starred_url":"https://api.github.com/users/georgeboot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgeboot/subscriptions","organizations_url":"https://api.github.com/users/georgeboot/orgs","repos_url":"https://api.github.com/users/georgeboot/repos","events_url":"https://api.github.com/users/georgeboot/events{/privacy}","received_events_url":"https://api.github.com/users/georgeboot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-08-08T09:33:07Z","updated_at":"2015-10-14T11:38:17Z","closed_at":"2015-08-08T09:55:25Z","body":"I'm using Laravel 4.2 with the `Mandrill` driver, and `beanstalkd` as queue driver, all on a Forge server.\r\n\r\nIn my app I queue emails with the following syntax:\r\n```php\r\nMail::queue('emails.welcome', $data, function($message) use ($data)\r\n{\r\n    $message->to($data['email']);\r\n    $message->subject('Registration confirmation for ' . $data['event_short_title']);\r\n\r\n});\r\n```\r\n\r\nNow, from times to times the emails ending up actually sent have the correct `to` and `subject`, but the rendered template is incorrect. It actually is a email that was sent weeks ago. So far I was able to stop the issue by restarting the queue worker, but every time it returns after a while.\r\n\r\nI searched though the code myself, but was not able to find any issue. I captured some payload but that looks 100% fine. In fact, I captured some payload, let it execute by the worker and found that the addressee and object of the sent email were correct, the body was not.\r\n\r\nBelow is an example of a captured payload. The email that was sent by the hander contained a different content then specified in the below payload.\r\n```\r\n{\r\n    \"job\":\"mailer@handleQueuedMessage\",\r\n    \"data\":{\r\n        \"view\":\"emails.registrationConfirmation\",\r\n        \"data\":{\r\n            \"firstname\":\"George\",\r\n            \"event_short_title\":\"Slanghoek MTB Triathlon\",\r\n            \"event_id\":1641,\r\n            \"registration_id\":1034871,\r\n            \"mail_reason\":\"You are receiving this email because you registered for Slanghoek MTB Triathlon\",\r\n            \"organiser_id\":5,\r\n            \"fullname\":\"George Boot\",\r\n            \"email\":\"george@xxxxxxxx.nl\"\r\n        },\r\n        \"callback\":\"C:38:\\\\\"Illuminate\\\\\\\\Support\\\\\\\\SerializableClosure\\\\\":547:{\r\n            a:2:{\r\n                i:0;s:160:\\\\\"function ($message) use($data) {\r\n                    \\\\n    $message->to($data[\r\n                        \\'email\\'\r\n                    ],\r\n                     $data[\r\n                        \\'fullname\\'\r\n                    ])->subject(\\'Registration confirmation for \\' . $data[\r\n                        \\'event_short_title\\'\r\n                    ]);\\\\n\r\n                };\\\\\";i:1;a:1:{\r\n                    s:4:\\\\\"data\\\\\";a:8:{\r\n                        s:9:\\\\\"firstname\\\\\";s:6:\\\\\"George\\\\\";s:17:\\\\\"event_short_title\\\\\";s:23:\\\\\"Slanghoek MTB Triathlon\\\\\";s:8:\\\\\"event_id\\\\\";i:1641;s:15:\\\\\"registration_id\\\\\";i:1034871;s:11:\\\\\"mail_reason\\\\\";s:79:\\\\\"You are receiving this email because you registered for Slanghoek MTB Triathlon\\\\\";s:12:\\\\\"organiser_id\\\\\";i:5;s:8:\\\\\"fullname\\\\\";s:11:\\\\\"George Boot\\\\\";s:5:\\\\\"email\\\\\";s:17:\\\\\"george@xxxxxxxx.nl\\\\\";\r\n                    }\r\n                }\r\n            }\r\n        }\"\r\n    }\r\n}\r\n```\r\n\r\nAny thoughts what might be going on here? I almost can't image this is a Laravel bug, but I'm also pretty confident I'm not doing something wrong."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/148024493","html_url":"https://github.com/laravel/framework/issues/9881#issuecomment-148024493","issue_url":"https://api.github.com/repos/laravel/framework/issues/9881","id":148024493,"user":{"login":"crynobone","id":172966,"avatar_url":"https://avatars.githubusercontent.com/u/172966?v=3","gravatar_id":"","url":"https://api.github.com/users/crynobone","html_url":"https://github.com/crynobone","followers_url":"https://api.github.com/users/crynobone/followers","following_url":"https://api.github.com/users/crynobone/following{/other_user}","gists_url":"https://api.github.com/users/crynobone/gists{/gist_id}","starred_url":"https://api.github.com/users/crynobone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crynobone/subscriptions","organizations_url":"https://api.github.com/users/crynobone/orgs","repos_url":"https://api.github.com/users/crynobone/repos","events_url":"https://api.github.com/users/crynobone/events{/privacy}","received_events_url":"https://api.github.com/users/crynobone/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T11:38:17Z","updated_at":"2015-10-14T11:38:17Z","body":"If you using `php artisan queue:work --daemon` you need to run `php artisan queue:restart` whenever you deploy new code/change configuration, because the daemon worker is executed before the deployment, hence using the old code (until it timeout or fail, then your code will respawn the daemon using new deployed code)."}}