quextum/

emails

发送电子邮件

1.0.10 2022-06-08 08:28 UTC

This package is auto-updated.

Last update: 2024-09-08 13:41:38 UTC


README

配置

在配置文件 config.neon 中注册扩展

    extensions:
        emails: App\Emails\EmailsExtension

之后设置扩展。示例配置

    parameters:
        domain: domain.com
        title: Title

    emails:
        templates: '%appDir%/emails/templates'
        default:
            from: [noreply@%domain%, %title%]
        password < default:
            subject: Nastavení hesla na stránkách %domain%
            variables:
                imagesUrl: https://cdn.domain.com/xyz/
        registration < default:
            subject: Byl jste přidán do systému %domain%
        notification < default:
            subject: Notifikace ze systému %domain%
        contact < default:
            subject: Zpráva z kontaktního formuláře serveru %domain%
            attachment:
                - %appDir%/emails/assets/about_blank.pdf
            embed:
                - %appDir%/emails/assets/prosky-logo.png
            to:
                test@email.cz: Jan Novák
                - test2@email.com
                - "Jan Novák <test3@email.com>"

可设置

    to
    from
    subject
    cc
    bcc
    reply
    return
    embed
    attachment

用法

在演示者中

$this->context->getService('emails')->send('registration', ['to' => $user->email],['userEntity'=> $user]);

参数

  1. 类型。必须存在指定类型的配置和同名模板。
  2. 设置。此设置将与配置中定义的设置关联。方法参数中的设置比配置文件中的设置具有更高的权重。
  3. 模板变量。