MsgMail.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Mail;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Mail\Mailable;
  6. use Illuminate\Queue\SerializesModels;
  7. class MsgMail extends Mailable
  8. {
  9. use Queueable, SerializesModels;
  10. protected $aToUsers;
  11. /**
  12. * Create a new message instance.
  13. *
  14. * @return void
  15. */
  16. public function __construct($aToUsers)
  17. {
  18. $this->aToUsers = $aToUsers;
  19. }
  20. /**
  21. * Build the message.
  22. *
  23. * @return $this
  24. */
  25. public function build()
  26. {
  27. // 收件人
  28. $this->to($this->aToUsers);
  29. // 抄送人
  30. $this->cc(['411693135@qq.com']);
  31. // 密送人
  32. $this->bcc(['411693135@qq.com']);
  33. // 附件 使用绝对路径
  34. // $this->attach('D:\phpstudy_pro\WWW\video_system\public\1.docx');
  35. /**
  36. * storage 路径添加附件
  37. * 默认 storage/app 路径前缀,补足后面的路径即可
  38. * 前缀具体看 app/config/filesystems.php 中 local.root 的配置
  39. */
  40. $this->attachFromStorage('public/2.docx');
  41. return $this->view('mail-msg');
  42. }
  43. }