wpscholar/wp-email 问题修复 & 功能扩展

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

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

wpscholar/wp-email

最新稳定版本:1.0.2

Composer 安装命令:

composer require wpscholar/wp-email

包简介

A WordPress library to simplify sending emails.

README 文档

README

A WordPress library to simplify sending emails.

What It Does

While WordPress does have the wp_mail() function, there are still a number of things you have to be aware of when sending emails. For example:

  • You have to add a special filter to send an HTML email.
  • You have to add a special filter to set the from name and/or email.
  • Special characters in the email subject line or from name may not show properly if not properly decoded.
  • To add CC or BCC recipients to an email, you have to add special headers.
  • Email recipients have to be properly formatted if you want to include a name.
  • Adding filters can impact other emails sent via the system.

This library removes these concerns and makes it easy to setup and send emails without impacting other emails being sent from the system.

How to Use It

  1. Add to your project via Composer:
$ composer require wpscholar/wp-email
  1. Make sure you have added the Composer autoloader to your project:
<?php

require __DIR__ . '/vendor/autoload.php';
  1. Create a new email:
<?php

use wpscholar\WordPress\Email;

// Create new email instance
$email = new Email();

// Set subject and message
$email->subject = 'Welcome!';
$email->message = '<p>Lorem ipsum dolor sit amet...</p>';

// Customize the from name and email
$email->from( 'John Doe <john@email.com>' );

// Add any recipients
$email->addRecipient( 'Jane Doe <jane@email.com>' );
$email->addCcRecipient( 'James Doe <james@email.com>' );
$email->addBccRecipient( 'Super Spy <topsecret@email.com>' );

// Add any attachments
$email->addAttachment( '/wp-content/uploads/attachment.pdf' );

// Send email
$email->send();

OR

<?php

use wpscholar\WordPress\Email;

$email = new Email( [
	'subject'     => 'Welcome!',
	'message'     => '<p>Lorem ipsum dolor sit amet...</p>',
	'from'        => 'John Doe <john@email.com>',
	'to'          => [ 'Jane Doe <jane@email.com>' ],
	'cc'          => [ 'James Doe <james@email.com>' ],
	'bcc'         => [ 'Super Spy <topsecret@email.com>' ],
	'attachments' => [ '/wp-content/uploads/attachment.pdf' ],
] );

$email->send();

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2017-10-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固