PHPackages                             yng/yng-mailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. yng/yng-mailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

yng/yng-mailer
==============

📧 YNG Mail: Easy and fast PHP email creation and transfer library, supporting text and HTML compatibility.

026PHP

Since Jun 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yng666/yng-mailer)[ Packagist](https://packagist.org/packages/yng/yng-mailer)[ RSS](/packages/yng-yng-mailer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

YNG Mailer
==========

[](#yng-mailer)

基于phpmailer进行了简单封装 支持PHP5.5+
============================

[](#基于phpmailer进行了简单封装支持php55)

安装

```
composer require yng/mailer
```

###### 发送SMTP邮件

[](#发送smtp邮件)

```
$mail = new Yng\Mailer\YNGMailer;
$mail->send([
		'to'  => 'Yng1@example.com',
		// 'to'  => ['Yng1@example.com' => 'yng'],// 邮件 => 发件人名
		'cc'  => 'Yng2@example.com',//抄送
		// 'cc'  => ['Yng2@example.com' => 'yng',...],
		'bcc' => 'Yng3@example.com',//密送
		// ...
	],
	'this is subject',//主题
	[
		'content'    => "Hello, Welcome to use Yng-Mailer body",//内容
		'altbody'    => '如果邮件客户端不支持HTML则显示此内容',//提示语
		// 'attachment' => ['/www/wwwroot/blog/public/aaa.txt'],//附件 绝对路径
		'attachment' => ['/www/wwwroot/blog/public/aaa.txt' => 'aaa.txt'],//附件 绝对路径 => 文件名
	],
);
```

###### 配置

[](#配置)

需在`env`文件配置或者`config/mailer.php`里配置

```
return [

    // 邮件驱动 支持smtp,mail,sendmail,qmail,默认SMTP
    'mail_mailer'     => 'SMTP',

    // 是否调试,0无输出，1输出客户端信息，2输出客户端和服务端信息，3显示连接状态，客户端 -> 服务器和服务器 -> 客户端消息，4显示所有消息
    'mail_debug'      => env('mail_debug',0),

    // 主机地址：例如smtp.qq.com, smtp.163.com等
    'mail_host'       => env('mail_host','smtp.qq.com'),

    // 是否启用smtp认证，true/false
    'mail_smtpauth'   => env('mail_smtpauth',true),

    // 发件人邮箱
    'mail_username'   => env('mail_username','yng@example.com'),

    // 授权码
    'mail_password'   => env('mail_password',''),

    // 端口号 常用有465, 25;具体看官方设置
    'mail_port'       => env('mail_port',25),

    // 协议,支持ssl, tls
    'mail_smtpsecure' => 'ssl',

    // 发件人名称
    'mail_from_name'  => '野牛哥',

    // 是否输出异常信息
    'mail_is_error'   => true,

    // 超时时间,默认5分钟,单位秒
    'mail_timeout'    => env('mail_timeout',300),

    // 日志存放路径,为空默认不存,绝对路径
    'mail_log_path'   => '',

    // 邮件编码,默认utf-8
    'mail_charset'    => env('mail_charset','utf-8'),
];
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/96970b9790e831710268790f4260e41e5d2c67de273a1f9502a1729fbc47df4f?d=identicon)[yng666](/maintainers/yng666)

### Embed Badge

![Health badge](/badges/yng-yng-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/yng-yng-mailer/health.svg)](https://phpackages.com/packages/yng-yng-mailer)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M228](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
