如何使用OctoberCms发送邮件?

问题描述 投票:0回答:2

如何在表单提交后以octobercms发送电子邮件?我在octobercms的后端邮件模板中创建了一封邮件,邮件代码是contact :: form。

// $data has name and email 
        $to = System\Models\MailSettings::get('[email protected]');
        Mail::sendTo($to, 'contact::form', $data);
        return true;

我收到这个错误:

找不到\ Components \ System \ Models \ MailSettings

laravel email octobercms octobercms-plugins
2个回答
0
投票

不确定你使用MailSettings::get('[email protected]')的是什么,但你可以删除该行,只需传入电子邮件地址:

Mail::sendTo('[email protected]', 'contact::form', $data);

0
投票

您是否正确配置邮件系统以发送邮件?

enter image description here

你需要什么邮件设置信息?删除该行。我相信除非您在邮件功能中指定,否则将自动使用电子邮件。

我相信您需要将Mail类(可能是输入)添加到您的组件,如下所示:

use Mail;
use Input;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.