I have a listener which implement ShouldQueue, the listener is handling a mail sending when event occurs. The job detects which type of user gets the email and config the mail sender name :
$displayName = $user->is_type() == 1 ? 'sender_name1' : 'sender_name2';
config(['mail.from' =>
[
'name' => $displayName
]]);
On multiple actions the sender name is sent incorrectly even though the config occurs. By printing getmypid() looks like the job runs on a process that already took care of an older job and the sender name that used was of the older one.
Any suggestions for a solution please?