Skip to content
Mitsuru Mutaguchi edited this page Apr 6, 2020 · 10 revisions

(英語準備中)

Sample

.env

// php mail()でメール送信する設定

MAIL_DRIVER=sendmail
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME=Example

Plugin

use Illuminate\Support\Facades\Mail;
use App\Mail\ConnectMail;

class HogePlugin extends UserPluginBase
{

    public function index($request, $page_id, $frame_id, $errors = [])
    {
        // メール送信
        $to_mail_address = 'hello@example.com';
        $mail_subject = 'テスト件名';
        $mail_text = "本文\n本文2";
        Mail::to(trim($to_mail_address))->send(new ConnectMail(['subject' => $mail_subject, 'template' => 'mail.send'], ['content' => $mail_text]));
    }

参照

https://github.com/opensource-workshop/connect-cms/blob/master/app/Mail/ConnectMail.php

Clone this wiki locally