Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 2.09 KB

fSMTP.wiki

File metadata and controls

66 lines (47 loc) · 2.09 KB

Table of Contents

fSMTP

<<css mode="next" class="sidebar"></css>> (((

Class Resources <<toc></toc>>

 - '''<a href="/docs/fSMTP">Class Documentation</a>'''
 - <a href="/api/fSMTP">API Reference</a>
 - <a href="https://github.com/flourishlib/flourish-classes/blob/master/fSMTP.php" target="_blank">Source Code</a>

<<toc></toc>>

Email Classes <<toc></toc>>

 - fEmail
 - fMailbox
 - '''fSMTP'''

)))

The fSMTP class allows for sending emails with fEmail via an SMTP server. It supports multiple authentication methods, secure connections (including via `STARTTLS`) and increased sending performance via SMTP pipelining.

Instantiation

Creating an SMTP connection can be as simple as passing the IP address or hostname of the `$server`.

In addition to the `$server`, it is also possible to specify the `$port`, if the connection is `$secure` and the `$timeout`.

Secure connections require the openssl extension. If a secure connection is not requested, but the SMTP server provides `STARTTLS` functionality, fSMTP will automatically upgrade the connection to be secure.

Authentication

fSMTP also supports SMTP authentication. Simple pass a `$username` and `$password` to ::authenticate(). This should be called before trying to send any emails.

Behind the scenes, there are four authentication methods supported: digest-md5, cram-md5, plain and login. The more secure digest-md5 and cram-md5 methods will be used if possible since they do not send login credentials in the clear.

Sending Messages

Sending messages via fEmail and fSMTP is extremely simple, just pass the fSMTP object to fEmail::send():

Closing the Connection

The connection to the SMTP server will be automatically closed at the end of the script. If there is a need to close it before then, simply call ::close().