This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

noideawhattotypehere
noideawhattotypehere

Hi,

I cannot get Mail to set subject on the fly, its using backends template subject all the time, code below:

Mail::send('something::mailing.template', ['body' => $message['body']], function ($m) use ($message) {
                $m->to($message['recipent']);
                $m->subject($message['subject']);
            });

Last updated

noideawhattotypehere
noideawhattotypehere

Nevermind, found the solution, if someone would ever face this problem:

In your layout, in the subject type a variable, lets say:

{{ subject }}

And when you send a message:

Mail::send('something::mailing.template', ['body' => $message['body'], 'subject' => $message['subject']], function ($m) use ($message) {
                $m->to($message['recipent']);
            });

Looks like documentation (https://octobercms.com/docs/services/mail#sending-mail) is wrong

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.