
Creates a connection to an SMTP server to be used by fEmail
1.0.0b11 | Enhanced the error checking for write() 6/3/11 |
---|---|
1.0.0b10 | Added code to work around PHP bug #42682 (http://bugs.php.net/bug.php?id=42682) where stream_select() doesn't work on 64bit machines from PHP 5.2.0 to 5.2.5, improved timeouts while reading data 1/10/11 |
1.0.0b9 | Fixed a bug where lines starting with . and containing other content would have the . stripped 9/11/10 |
1.0.0b8 | Updated the class to use fEmail::getFQDN() 9/7/10 |
1.0.0b7 | Updated class to use new fCore::startErrorCapture() functionality 8/9/10 |
1.0.0b6 | Updated the class to use new fCore functionality 7/5/10 |
1.0.0b5 | Hacked around a bug in PHP 5.3 on Windows 6/22/10 |
1.0.0b4 | Updated the class to not connect and authenticate until a message is sent, moved message id generation in fEmail 5/5/10 |
1.0.0b3 | Fixed a bug with connecting to servers that send an initial response of 220- and instead of 220 4/26/10 |
1.0.0b2 | Fixed a bug where STARTTLS would not be triggered if it was last in the SMTP server's list of supported extensions 4/20/10 |
1.0.0b | The initial implementation 4/20/10 |
Configures the SMTP connection
The SMTP connection is only made once authentication is attempted or an email is sent.
Please note that this class will upgrade the connection to TLS via the SMTP STARTTLS command if possible, even if a secure connection was not requested. This helps to keep authentication information secure.
fSMTP __construct( string $host, integer $port=NULL, boolean $secure=FALSE, integer $timeout=NULL )
string | $host | The hostname or IP address to connect to |
integer | $port | The port number to use |
boolean | $secure | If the connection should be secure - if STARTTLS is available, the connection will be upgraded even if this is FALSE |
integer | $timeout | The timeout for the connection - defaults to the default_socket_timeout ini setting |
Closes the connection to the SMTP server
void __destruct( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
All requests that hit this method should be requests for callbacks
callback __get( string $method )
string | $method | The method to create a callback for |
The callback for the method requested
Authenticates with the SMTP server
This method supports the digest-md5, cram-md5, login and plain SMTP authentication methods. This method will try to use the more secure digest-md5 and cram-md5 methods first since they do not send information in the clear.
void authenticate( string $username, string $password )
string | $username | The username |
string | $password | The password |
Closes the connection to the SMTP server
void close( )
Sets if debug messages should be shown
void enableDebugging( boolean $flag )
boolean | $flag | If debugging messages should be shown |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sends a message via the SMTP server
void send( string $from [, ... ], string $headers, string $body )
string | $from | The email address being sent from - this will be used as the Return-Path header |
array | $to | All of the To, Cc and Bcc email addresses to send the message to - this does not affect the message headers in any way |
string | $headers | The message headers - the Bcc header will be removed if present |
string | $body | The mail body |