ioioioioioioi
V2EX  ›  PHP

分享基于 PHPMailer 的 mail 函数

  •  
  •   ioioioioioioi · Feb 20, 2017 · 2579 views
    This topic created in 3544 days ago, the information mentioned may be changed or developed.

    mail 函数使用方法:

    \mail::to('[email protected]')
            ->subject('test subject')
            ->body('<p>hi world</p>')
            ->embed(['img/ban.png', 'img/about.png'])
            ->attach('img/test.pdf')
            ->send();
    
    大家觉得如何,明天我把源码整理下贴出来。
    
    Supplement 1  ·  Feb 21, 2017

    如果没有phpdotenv, 需要把相应的env()改下。

    推荐封装一个css_inline函数。

    如果没有Facde,使用方法:

    
    $mailer = new \Classes\Mail;
    
    
    $mailer->to('[email protected]')
            ->subject('test subject')
            ->body('<p>hi world</p>')
            ->embed(['img/ban.png', 'img/about.png'])
            ->attach('img/test.pdf')
            ->send();
    
    
    Supplement 2  ·  Feb 21, 2017
    源码在此:/t/342029#reply0
    5 replies  •  2017-03-21 14:19:00 +08:00
    kimwang
    kimwang
    Feb 20, 2017
    1
    官人我要~
    Yien
    Yien
    Feb 20, 2017 via iPhone
    2
    官人我还要~
    xbdsky
    xbdsky
    Feb 21, 2017
    3
    官人我要要要~
    log4geek
    log4geek
    Mar 21, 2017
    5
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1545 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:16 · PVG 07:16 · LAX 15:16 · JFK 18:16
    ♥ Do have faith in what you're doing.