bnomei/kirby-resend 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bnomei/kirby-resend

最新稳定版本:1.0.0

Composer 安装命令:

composer require bnomei/kirby-resend

包简介

Send transactional E-Mail with Resend

README 文档

README

Release Downloads Build Status Coverage Status Maintainability Twitter

Send transactional E-Mail with Resend

Sending via SMTP

<?php

// regular "transactional" email
$to = 'roger.rabbit@disney.com';

$success = kirby()->email([
    'from' => new \Kirby\Cms\User([
        'email' => 'resend@example.com', // your verified resend sender
        'name' => 'Example Name', // your name
    ]),
    'to' => $to,
    'subject' => 'Sending E-Mails is fun',
    'body' => [
        'html' => '<h1>Headline</h1><p>Text</p>',
        'text' => "Headline\n\nText",
    ],
    'transport' => resend()->transport(), // plugin helper to get SMTP config array
])->isSent();

Sending via PHP lib (work in progress)

$client = resend()->client();
$sendResult = $client->emails->send([
    'from' => 'onboarding@resend.dev',
    'to' => 'delivered@resend.dev',
    'subject' => 'Hello World',
    'html' => '<strong>it works!</strong>',
]);

// Getting the ID from the response Email object
// https://github.com/resendlabs/resend-php/blob/main/src/Email.php
echo $sendResult->id;

Sending Kirby Panel emails via Resend

If you want to make Kirby use Resend to send emails like the password reset from panel you have to set global auth and email config values.

site/config/config.php

return [
    // …other settings
    'auth' => [
        'methods' => ['password', 'password-reset'],
        'challenge' => [
            'email' => [
                'from'     => 'resend@example.com', // your verified postmark sender
                'fromName' => 'Example Name',
            ]
        ]
    ],
    'email' => [
        'transport' => [
            'type' => 'smtp',
            'host' => 'smtp.resend.com',
            'port' => 587,
            'security' => true,
            'auth' => true,
            'username' => 'resend', // needs to be 'resend'
            'password' => 'YOUR-APIKEY-HERE', // your resend apikey
        ]
    ]
];

Settings

You can set the apikey in the config.

site/config/config.php

return [
    // other config settings ...
    'bnomei.resend.apikey' => 'YOUR-APIKEY-HERE',
];

You can also set a callback if you use the dotenv Plugin.

site/config/config.php

return [
    // other config settings ...
    'bnomei.resend.apikey' => function() { return env('RESEND_APIKEY_TOKEN'); },
];

Settings

Dependencies

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-03