ioioioioioioi
V2EX  ›  PHP

分享基于 PHPMailer 的 mail 函数

  •  
  •   ioioioioioioi · Feb 20, 2017 · 2330 views
    This topic created in 3418 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
        1
    kimwang  
       Feb 20, 2017
    官人我要~
    Yien
        2
    Yien  
       Feb 20, 2017 via iPhone
    官人我还要~
    xbdsky
        3
    xbdsky  
       Feb 21, 2017
    官人我要要要~
    ioioioioioioi
        4
    ioioioioioioi  
    OP
       Feb 21, 2017
    log4geek
        5
    log4geek  
       Mar 21, 2017
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3277 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:15 · PVG 20:15 · LAX 05:15 · JFK 08:15
    ♥ Do have faith in what you're doing.