\SmtpMailer
This is a simple extension of the built in SS email class that uses the PHPMailer library to send emails via SMTP.
Usage: (in mysite/_config.php)
$mailer = new SmtpMailer('mail.server.com', 'username', 'password');
Email::set_mailer($mailer);
- Author: Mark Guinn <mark@adaircreative.com>
Synopsis
class SmtpMailer
extends Mailer
{
- // members
- protected $host;
- protected $user;
- protected $pass;
- protected $charset;
- protected bool $tls;
- protected $port;
- protected $encryption;
- protected $smtpDebug;
- // methods
- public void __construct()
- public $this; setHost()
- public string getHost()
- public $this; setCredentials()
- public $this setTls()
- public boolean getTls()
- public $this setPort()
- public int getPort()
- public $this setEncryption()
- public mixed getEncryption()
- public $this setCharset()
- public string getCharset()
- public $this setSMTPDebug()
- protected void initMailer()
- protected array splitName()
- protected void explodeList()
- protected void initEmail()
- public bool|array sendPlain()
- public bool checkMailError()
- public bool sendHTML()
Hierarchy
Extends
- Mailer
Tasks
Line | Task |
---|---|
438 | inlineimages |
Members
protected
- $charset — string
- $encryption — mixed
- $host — string
- $pass — string
- $port — int
- $smtpDebug — int
- $tls — bool
- $user — string
Methods
protected
- explodeList() — takes a list of emails, splits out the name and calls the given function. meant to be used with AddAddress, AddBcc and AddCc
- initEmail() — shared setup for both html and plain
- initMailer() — creates a new phpmailer object
- splitName() — takes an email with or without a name and returns email and name as separate parts
public
- __construct() — creates and configures the mailer
- checkMailError()
- getCharset()
- getEncryption() — Get the encryption to use
- getHost() — Get the SMTP host
- getPort() — Get the server port
- getTls()
- sendHTML() — Send a multi-part HTML email.
- sendPlain() — Send a plain-text email.
- setCharset()
- setCredentials() — sets the username and password
- setEncryption() — Set the encryption to use. Either 'ssl', 'tls' or false
- setHost() — sets the smtp host
- setPort() — Set the server port
- setSMTPDebug()
- setTls()