当然可以,我建议您使用:Laravel Mail Auto Embed
它的使用非常简单,您通常会编写降价记录:
<!-- eg: resources/vendor/mail/markdown/order-shipped.blade.php -->
@component('mail::message')
# Order Shipped
Your order has been shipped!
@component('mail::button', ['url' => $url])
View Order
@endcomponent
Purchased product:
![product](https://domain .com/products/product-1.png)
Thanks,<br>
{{ config('app.name') }}
@endcomponent
并且当您发送电子邮件时,它将替换内联数据的url图片,这最容易处理和转发电子邮件
发送时,它将替换通常会生成的链接:
<img src="https://example.com/products/product-1.png">
by an embedded inline attachment of the image:
<img src="cid:[email protected]">
我给你个主意
首先,您需要从laravel-imap中获取此电子邮件数据并将其存储在变量中
首先,您需要指定所需的消息,例如,您正在寻找的消息中包含可以指定的特定信息像这样
foreach($aFolder as $oFolder){
//Get all messages by custom search criteria
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
$aMessage = $oFolder->query()->where(["CUSTOM_Word" => "Hello"]])->get();
}
现在您有一封包含其所有组成部分的特定电子邮件
现在将其发送到所需的电子邮件或电子邮件列表(使用foreach)
然后将$ aMessage变量传递到您的发送函数中
$receiver_email = '[email protected]';
$data = array ('subject' => '$aMessage->getSubject().'<br />'' ,
'Attachments' => '$aMessage->getAttachments()->count().'<br />'',
'body' => '$aMessage->getHTMLBody(true)';
)
Mail::send('emails.message', $data, function ($message) {
$message->to($receiver_email)
->subject($aMessage->getSubject());
$message->from('[email protected]' , 'your name')
});
并且在您的电子邮件/消息中,请不要忘记将自定义消息的主题,附件和正文作为输出内容
注意:您可能会发现一些错别字或错误,因为就像我告诉您的一样,我给了您这个主意,但不能完全给您想要的。