You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class SendEmail implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(public array|string $from, public string $subject = '', public string|array $to = [], public array|string $cc = [], public array|string $bcc = [], public string $content = '')
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
Mail::html($this->content, function (Message $message) {
$message->to($this->to)
->bcc($this->bcc)
->cc($this->cc)
->subject($this->subject);
if (is_array($this->from)) {
$message->from(...$this->from);
} else {
$message->from($this->from);
}
});
}
}
Steps To Reproduce
If sending email like this: dispatch(new SendEmail(subject: 'test', to: '[email protected]', content: 'test'));
The email will be sent to alwaysTo address.
If dispatching like this: dispatch_sync(new SendEmail(subject: 'test', to: '[email protected]', content: 'test'));
The email will NOT be sent to alwaysTo address...
BTW I'm using octane, so it might be 1 reason why it doesn't work.
The text was updated successfully, but these errors were encountered:
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Laravel Version
11.24.1
PHP Version
8.3.6
Database Driver & Version
No response
Description
In my AppServiceProvider boot method I have
I have a job that sends an email.
Steps To Reproduce
If sending email like this:
dispatch(new SendEmail(subject: 'test', to: '[email protected]', content: 'test'));
The email will be sent to alwaysTo address.
If dispatching like this:
dispatch_sync(new SendEmail(subject: 'test', to: '[email protected]', content: 'test'));
The email will NOT be sent to alwaysTo address...
BTW I'm using octane, so it might be 1 reason why it doesn't work.
The text was updated successfully, but these errors were encountered: