承接 vajexal/amp-mailer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

vajexal/amp-mailer

Composer 安装命令:

composer require vajexal/amp-mailer

包简介

SMTP mailer for amphp

README 文档

README

Sending mail using SMTP and amphp

Build Status codecov

Installation

composer require vajexal/amp-mailer

Usage

<?php

declare(strict_types=1);

use Amp\Loop;
use Vajexal\AmpMailer\Mail;
use Vajexal\AmpMailer\MailerBuilder;

require_once 'vendor/autoload.php';

Loop::run(function () {
    $mailer = (new MailerBuilder)
        ->host('...')
        ->port(2525)
        ->username('...')
        ->password('...')
        ->build();

    $mail = (new Mail)
        ->from('from@example.com')
        ->to('to@example.com')
        ->subject('Test')
        ->text('Test');

    yield $mailer->send($mail);
});

More complex mail

use Vajexal\AmpMailer\Mail;

$mail = (new Mail)
    ->from('from@example.com', 'from') // email and username
    ->replyTo('reply1@example.com', 'reply1')
    ->replyTo('reply2@example.com')
    ->to('to1@example.com', 'to1')
    ->to('to2@example.com')
    ->cc('cc1@example.com', 'cc1')
    ->cc('cc2@example.com')
    ->bcc('bcc1@example.com', 'bcc1')
    ->bcc('bcc2@example.com')
    ->subject('Test')
    ->text('Test')
    ->html('<b>Test</b>');

Attaching files

use Vajexal\AmpMailer\Attachment;
use Vajexal\AmpMailer\Mail;

$mail = (new Mail)
    ->attach(yield Attachment::fromPath('doc.pdf'));

Embedding files

use Vajexal\AmpMailer\Attachment;
use Vajexal\AmpMailer\Mail;

$mail = new Mail;

$mail->html('<img src="' . $mail->embed(yield Attachment::fromPath('image.png')) . '" alt="Embedding example">');

Sending few emails

use Vajexal\AmpMailer\Mail;

$mails = \array_map(
    fn ($name) => (new Mail)
        ->from('from@example.com')
        ->to(\sprintf('%s@example.com', \mb_strtolower($name)))
        ->subject('Hello')
        ->text(\sprintf('Hello %s', $name)),
    ['Bar', 'Baz']
);

yield $mailer->sendMany($mails);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2020-11-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固