mouf/utils.mailer.smtp-mail-service 问题修复 & 功能扩展

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

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

mouf/utils.mailer.smtp-mail-service

Composer 安装命令:

composer require mouf/utils.mailer.smtp-mail-service

包简介

This package contains a mailer that uses a SMTP server to send mail. The package is a wrapper around the Zend_Mail class of the Zend framework.

README 文档

README

The SmtpMailService is used to send mails using a SMTP mail server.

The SmtpMailService is designed to be simple to use. Behind the scene, the SmtpMailService is using the more complex (and more powerful) ZendFramework 2 mail service.

Install

This package is part of the Mouf PHP framework. As such, it comes with a nice graphical installer.

Install screen

You can configure the settings to connect to your SMTP server.

There is one compulsory parameter: host, which is the address of the server.

By default, on Linux systems, it is likely you will use the local mail server (host=127.0.0.1). You will have a "sendmail" or "postfix" server installed on your machine. If you are performing your developments on a Windows machine, it is quite likely that you will not have an SMTP server on your machine. You will therefore have to use a remote server. To access the remote server, you will certainly have to use login/passwords, etc...

When this package is installed, it will create a default "smtpMailService" and put in this instance all the parameters you have provided.

Note: nothing prevents you from creating several instances of the SmtpMailService class with different parameters (in the rare case you have an application that needs to connect to several SMTP servers).

After installation, you will see that a number of constants have been added to your config.php file. When deploying on other servers, you can of course change those constants to adapt to the settings of the server.

Tip: using your gmail account to send mails

In a development environment, it can be useful to use you gmail account. Here are the settings:

  • host => 'smtp.gmail.com'
  • ssl => 'tls'
  • port => 587
  • auth => 'login'
  • username => Your gmail mail address
  • password => Your password

Example use

Below is a sample code you can use to send a mail.

use Mouf\Utils\Mailer\Mail;
use Mouf\Utils\Mailer\SmtpMailService;

// First, let's create the mail object
$mail = new Mail();
$mail->setTitle("My mail");
$mail->setBodyText("This is my mail!");
$mail->setBodyHtml("This is my <b>mail</b>!");
$mail->setFrom(new MailAddress("my@server.com", "Server"));
$mail->addToRecipient(new MailAddress("david@email.com", "David"));

// Let's get the instance of the service
$mailService = Mouf::getSmtpMailService();

// Finally, we send the mail
$mailService->send($mail);

To learn more about how to send mails, refer to the Introduction to Mouf's mail architecture.

mouf/utils.mailer.smtp-mail-service 适用场景与选型建议

mouf/utils.mailer.smtp-mail-service 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.21k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2013 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「mail」 「mailer」 「service」 「smtp」 「mouf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mouf/utils.mailer.smtp-mail-service 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mouf/utils.mailer.smtp-mail-service 我们能提供哪些服务?
定制开发 / 二次开发

基于 mouf/utils.mailer.smtp-mail-service 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-13