用流明转发电子邮件与电子邮件库

时间:2018-11-23 13:06:24

标签: php laravel outlook lumen swiftmailer

我要转发带附件的邮件,

我写的代码如下,

$sent = Mail::send(['html' => 'email_render'], ['html' => $data["body"]], function ($msg) use ($data) {
            $msg->from($data["from_address"], $data["from_name"])
            ->to($data["to_address"])->subject("FW: test forward");//->setBody($data["body"]);
            if (isset($data["cc_address"])) {
                $msg->cc($data["cc_address"]);
            }
            if (isset($data["bcc_address"])) {
                $msg->bcc($data["bcc_address"]);
            }
            if (isset($data["attachment"])) {
                foreach ($data["attachment"] as $attachment) {
                    $msg->attach($attachment['file'], $attachment['options']);
                }
            }
            if (isset($data["message_id"])) {
                $msg->getSwiftMessage()->getHeaders()->addTextHeader("In-Reply-To", "<".$data["message_id"].">");
                $msg->getSwiftMessage()->getHeaders()->addTextHeader("References", self::getReferances($data));
            }
        });

我不确定,转发电子邮件是否正确?

如果我发送电子邮件有误,请纠正我

0 个答案:

没有答案