我正在发送一封简单的电子邮件,需要在正文和主题中使用变量。将变量传递到正文中效果很好,但在我的主题行上失败并显示未定义的变量
$body = "Attached is the " .$name. " Report for ".date('Y-m-d');
Mail::raw($body , function ($message) use ($emails,$filepath,$filename) {
$message->from('noreply@test.com', 'webmail');
$message->attach(storage_path($filepath.'/'.$filename.'.xlsx'));
foreach ($emails['to'] as $email) {
$message->to($email);
}
foreach ($emails['cc'] as $email) {
$message->cc($email);
}
$message->subject("Report for " .$name. " account");
});
为什么这里用的是body而不是subject呢?
largeQ