mail icon indicating copy to clipboard operation
mail copied to clipboard

Return value of HyperfExt\\Mail\\PendingMail::send() must be of the type array, bool returned

Open Adian-1012 opened this issue 4 years ago • 3 comments

配置使用smtp的ssl加密出现这个报错

用demo中的发送方式会报错 Mail::to($request->user())->send(new OrderShipped($order));

Return value of HyperfExt\\Mail\\PendingMail::send() must be of the type array, bool returned[149] in /var/www/fly2-intl-api/vendor/hyperf-ext/mail/src/PendingMail.php

image

Adian-1012 avatar Jun 03 '21 06:06 Adian-1012

目前我用queue异步队列发送成功

sanye4639 avatar Jun 29 '21 09:06 sanye4639

这好像是因为gen:mail生成的 Mail 类默认实现了ShouldQueue接口,导致send()方法会转到queue()方法(该方法返回 bool 值)。

图片

去掉该接口的实现就行。

Linnzh avatar Oct 04 '21 20:10 Linnzh

这个需要修复的吧,本身send方法是会根据类决定调用 queue 还是 send

PendingMail 的send方法限制了返回类型array 但是 queue 方法放回的类型是 bool

我觉得要不兼职send对两个返回类型的支持,要不取消send对queue方法的支持

这样会减少很多误解

Luoyang-MrZhang avatar Nov 23 '21 02:11 Luoyang-MrZhang