<<css mode="next" class="sidebar"></css>> (((
- '''<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>>
- 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.
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.
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 via fEmail and fSMTP is extremely simple, just pass the fSMTP object to fEmail::send():
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().