hahalo/php-mailer

通过 http 代理的 smtp 邮件发送者

v0.01 2020-10-31 19:17 UTC

This package is auto-updated.

Last update: 2024-09-29 06:08:33 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Build Status Coverage Status

使用 smtp 发送电子邮件(支持 http 代理)

安装

composer require Hahalo/php-mailer

使用说明

<?php

$transport = new \Hahalo\Mailer\SMTPTransport(
    [
        'host' => 'smtp.gmail.com',
        'port' => 465,
        'encryption' => 'ssl',
        'username' => 'your username',
        'password' => 'your password',
        
        'httpProxy' => 'http://proxy.com:8080' //user http proxy
    ]
);

$mailer = new \Hahalo\Mailer\Mailer($transport);
$mailer->setFrom('from@example.com')
    ->setTo('to@example.com')
    ->setSubject('subject')
    ->setText('email from php mailer')
    ->send();