laravel - 获取徽标以显示在电子邮件标题中
问题描述
我正在使用 Laravel 7 尝试在标题部分发送带有徽标的邮件,但它失败了。我可以将其作为附件发送,并且我在附件列表中看到了图像,但是如何在标题中获取它。
这种方式可以将图像作为附件发送。
return $this->markdown('emails.answered' )->attach($img_url);
这不起作用,或者它可能起作用,但我可以看到图像。
return $this->markdown('emails.answered', ['url_img'=>$img_url]);
这是构建我的可邮寄的构造
public function __construct($data)
{
$this->name = $data[0]['name'];
$this->id_no = $data[0]['id_no'];
$img_url = env('APP_URL')."img/logo.png";
$this->logo = $img_url;
}
在我的刀片中,我尝试过这个。
<img src="{{ $message->embed('img/logo.png') }}">
-->未定义变量:消息
和这个。
This is your logo
![Some option text][logo]
[logo]: {{$img_url}} "Logo"
但是没有人想在消息头中获取图像。
这是电子邮件中的图像代码。
<img src="https://ci3.googleusercontent.com/proxy/tUBy2qlV3Ewx803mJ1QPiZ4vxKrPrRAB8qsInc8TGzKEso9Q93o=s0-d-e1-ft#http://img/logo.png" alt="Some option text" title="Logo2" style="font-family:Avenir,Helvetica,sans-serif;box-sizing:border-box;max-width:100%" class="CToWUd">
解决方案
在您的电子邮件中,您收到http://img/logo.png"
此字符串意味着您的env('APP_URL').
此代码不起作用,因此您可以尝试一下
public function __construct($data)
{
$this->name = $data[0]['name'];
$this->id_no = $data[0]['id_no'];
$this->logo = asset('img/logo.png');
}
然后
This is your logo
![Some option text][logo]
[logo]: {{ $logo }} "Logo"
推荐阅读
- javascript - 数组对象排序不适用于 Javascript 中的大长度数据?
- android - 使用 CMake 构建的 Android 无法找到外部 C++ 库文件
- database - 在组合框中显示外部字段
- c# - 有没有办法让这个递归函数更快?
- python - 复制 pandas 列,根据前面的列给出值
- python - 套接字和 tkinter 未按顺序运行
- javascript - 如何从作为 JSON 响应返回的文件系统对象中分离文件和目录名称?
- python - 熊猫:根据条件更改单元格值
- javascript - 断开连接后保持 EC2 Windows 服务器处于活动状态
- python - 简单的 kivy 应用程序给了我一个错误(pycharm)