ezmail/ezmail 问题修复 & 功能扩展

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

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

ezmail/ezmail

Composer 安装命令:

composer require ezmail/ezmail

包简介

A lightweight package created with PHP using the official MIME documentation to send emails using the latest SMTP configuration

README 文档

README

Latest Stable Version License PHP Version Require

Overview

EZMAIL is a lightweight package created with PHP using the official MIME documentation to send emails using the latest SMTP configuration. By using this package you will be able to send emails securely to anyone with a valid email address.

Features

  • Send SMTP emails from PHP without mail()
  • Send one or multiple attachments supported
  • Send emails with multiple To, CC and BCC
  • Secure SMTP connection
  • Supports LOGIN, PLAIN and XOAUTH2 login types
  • Compatible with php 7.4 or later
  • Easy implementation within any php code
  • Supports Plain or HTML body
  • Log details while in debug mode

Further Documentation for developers

RFC0821

RFC0822

RFC1869

RFC2045

RFC2821

Installation

composer require ezmail/ezmail

Usage

<?php
    use EZMAIL\EZMAIL; //update this according to your path.
    use \Exceptions; 

    #Autoload
    require 'vendor/autoload.php';

    $ezmail = new EZMAIL();

    #Config
    $ezmail->appName = "EZMAIL";
    $ezmail->hostName = "smtp.myhost.com";
    $ezmail->portNumber = 123;
    $ezmail->username = "myUsername";
    $ezmail->password = "myPassword";

    #Email
    $ezmail->subject = "this is subject";
    $ezmail->body = "this is message";
    $ezmail->to = [ "Mr Recv" => "toEmail@example.com" ];
    # or
    $ezmail->to = [ "toEmail@example.com" ]; # name is optional for all address fields
    
    #Optionally can be configured directly from the constructor on PHP 8+
    #$ezmail = new EZMAIL(appName: "EZMAIL", hostName: "smtp.myhost.com", ...);

    #uncomment to send email with attachments. A full file path or url is required.
    //$ezmail->attachments = [ "My File.txt" => "https://mywebsite/myfile.txt" ];
    // or
    //$ezmail->attachments = [ "https://mywebsite/myfile.txt" ];

    try
    {
        $mailId = $ezmail->send(); // Mail ID from the mail server here.
    }
    catch(Exception $ex)
    {
        print($ex->getMessage());
    } 

List of available configurations

    #New instance
    $ezmail = new EZMAIL();

    $ezmail->subject = "";
    $ezmail->body = "";
    $ezmail->to = []; 
    $ezmail->from = []; //optional
    $ezmail->cc = []; //optional
    $ezmail->bcc = []; //optional
    $ezmail->replyTo = []; //optional
    $ezmail->attachments = []; //optional
    $ezmail->bounceAddress = ""; //optional
    $ezmail->skipMessageIdValidation = true; //optional

    #Connection.
    $ezmail->appName = "EZMAIL";
    $ezmail->hostName = "";
    $ezmail->portNumber = 587;
    $ezmail->username = "";
    $ezmail->password = "";
    $ezmail->timeout = 30; //optional
    $ezmail->authType = SMTP::AUTH_TYPE_STANDARD; // or SMTP::AUTH_TYPE_PLAIN, SMTP::AUTH_TYPE_2AUTH
    $ezmail->authToken = ""; //if using SMTP::AUTH_TYPE_2AUTH
    $ezmail->isDebug = false; //true to enable SMTP logging

    #send mail
    $ezmail->send();

Tips

  • If you are using gmail as your SMTP server you must enable the less secure apps on google. Learn more

Credits

@jerryurenaa

@realivanjx

License

EZMAIL is MIT licensed.

Powered by Nerdtrix.com | Reinventing the wheels for a better future!

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固