BGT*_*ate 5 php laravel laravel-5
我正在尝试在 laravel 邮件中使用内联附件,但似乎很不幸。我也试过这一个,但通过原始数据的embeding不起作用。我有一个 base 64 image/png 这里是它的一个例子。
现在我正在尝试使用 attachData 但如何->attachData
将mailtransaction.blade
. 我应该从我的控制器获取 attachData 但我应该调用什么变量?
控制器.php
Mail::send(['html'=>'mailtransaction'], $data_content, function($msg) use ($to, $issueType, $base64){
$msg->to($to); // change this upon finishing
$msg->attachData($base64, 'test.png', ['mime'=>'image/png']);
$msg->subject($issueType);
});
Run Code Online (Sandbox Code Playgroud)
mailtransaction.blade
<!DOCTYPE html>
<html>
<head>
</head>
<body style="width:100%;">
<div style="border:0px solid #000; width:1000px !important;">
<div style="display: inline-block;">
<img src="{{$message->embed('storage/app/public/images/logo.png')}}" height="50px" width="50px">
</div>
<div style="display: inline-block; vertical-align: top;">
<div style="font-size:24px; margin-bottom: -10px;">Fraud Detection Tool</div>
<div>Suspicious Transaction details</div>
</div>
<hr style="border:0px; border-bottom:1px solid #000; width:1000px;">
<div class="container">
{{$msg}}
//I supposedly get the attachData from my controller but what variable should I call?
</div>
<hr style="width:1000px;">
<div class="container_mail" style="width:600px !important;">
<img src="{{}}" height="auto" style="max-width: 1000px">
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
second
您可以将数据作为方法的参数传递到视图send()
,并且它必须是array
数据。将您的控制器更改为 -
Mail::send('mailtransaction', ['data_content'=>$data_content,'base64'=>$base64], function($msg) use ($to, $issueType){
$msg->to($to); // change this upon finishing
$msg->attachData($request->getBase64, 'test.png', ['mime'=>'image/png']);
$msg->subject($issueType);
});
Run Code Online (Sandbox Code Playgroud)
在您看来,您可以访问data_content
并base64
作为-
{{$data_content}}
{{$base64}}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3554 次 |
最近记录: |