ouranoshong/php-mailer

smtp mailer sender via http proxy

v0.2 2020-07-02 07:52 UTC

This package is auto-updated.

Last update: 2024-05-11 15:40:46 UTC


README

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

send email with smtp (support http proxy)

Install

composer require ouranoshong/php-mailer

Usage

Simple usage demo

<?php

$transport = new \Ouranoshong\Mailer\SMTPTransport(
    [
        'host' => 'smtp.gmail.com',
        'port' => 465,
        'encryption' => 'ssl',
        'username' => 'your username',
        'password' => 'your password'
    ]
);

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

Http proxy usage demo

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

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