Class Swift_Connection_SMTP

Description

Swift SMTP Connection

Located in /Swift/Connection/SMTP.php (line 20)

Swift_ConnectionBase
   |
   --Swift_Connection_SMTP
Class Constant Summary
Variable Summary
int $errno
string $errstr
resource $handle
string $password
int $port
int $timeout
string $username
Method Summary
Swift_Connection_SMTP __construct ([string $server = "localhost"], [int $port = null], [int $encryption = null])
void __destruct ()
void attachAuthenticator ( $auth)
int getEncryption ()
string getPassword ()
int getPort ()
string getServer ()
int getTimeout ()
string getUsername ()
boolean isAlive ()
void postConnect ( $instance)
string read ()
void runAuthenticators (string $user, string $pass,  $swift)
void setEncryption (int $enc)
void setPassword (string $pass)
void setPort (int $port)
void setServer (string $server)
void setTimeout (int $time)
void setUsername (string $user)
string smtpErrors ()
void start ()
void stop ()
void write (string $command, [ $end = "\r\n"])
Variables
array $authenticators = array() (line 80)

Loaded authentication mechanisms

  • access: protected
int $encryption = null (line 60)

Encryption type to use

  • access: protected
int $errno (line 85)

Fsockopen() error codes.

  • access: protected
string $errstr (line 90)

Fsockopen() error codes.

  • access: protected
resource $handle = null (line 50)

A connection handle

  • access: protected
string $password = false (line 75)

A password to authenticate with

  • access: protected
int $port = null (line 55)

The remote port number

  • access: protected
int $timeout = 15 (line 65)

A connection timeout

  • access: protected
string $username = false (line 70)

A username to authenticate with

  • access: protected

Inherited Variables

Inherited from Swift_ConnectionBase

Swift_ConnectionBase::$extensions
Swift_ConnectionBase::$isESMTP
Methods
Constructor __construct (line 98)

Constructor

  • access: public
Swift_Connection_SMTP __construct ([string $server = "localhost"], [int $port = null], [int $encryption = null])
  • string $server: The remote server to connect to
  • int $port: The remote port to connect to
  • int $encryption: The encryption level to use
Destructor __destruct (line 448)

Destructor.

Cleans up any open connections.

  • access: public
void __destruct ()
attachAuthenticator (line 200)

Add an authentication mechanism to authenticate with

  • access: public
void attachAuthenticator ( $auth)
getEncryption (line 226)

Get the current encryption level used

This method returns an integer corresponding to one of the constants ENC_TLS, ENC_SSL or ENC_OFF

  • access: public
int getEncryption ()
getPassword (line 192)

Get the password for authentication

  • access: public
string getPassword ()
getPort (line 158)

Get the remote port number currently used to connect

  • access: public
int getPort ()
getServer (line 137)

Get the remote server name

  • access: public
string getServer ()
getTimeout (line 116)

Get the timeout currently set for connecting

  • access: public
int getTimeout ()
getUsername (line 175)

Get the username for authentication

  • access: public
string getUsername ()
isAlive (line 440)

Check if the SMTP connection is alive

  • access: public
boolean isAlive ()
postConnect (line 327)

Authenticate if required to do so

  • access: public
  • throws: Swift_ConnectionException If authentication fails
void postConnect ( $instance)
  • Swift $instance: An instance of Swift

Redefinition of:
Swift_ConnectionBase::postConnect()
Execute any needed logic after connecting and handshaking
read (line 237)

Read a full response from the buffer

inner !feof() patch provided by Christian Rodriguez: <a href="http://www.flyspray.org/">www.flyspray.org</a>

  • access: public
  • throws: Swift_ConnectionException Upon failure to read
string read ()
runAuthenticators (line 342)

Run each authenticator in turn an try for a successful login

If none works, throw an exception

  • access: public
  • throws: Swift_ConnectionException Upon failure to authenticate
void runAuthenticators (string $user, string $pass,  $swift)
  • string $user: Username
  • string $pass: Password
  • Swift $swift: An instance of swift
setEncryption (line 216)

Set the encryption level to use on the connection

See the constants ENC_TLS, ENC_SSL and ENC_OFF NOTE: PHP needs to have been compiled with OpenSSL for SSL and TLS to work NOTE: Some PHP installations will not have the TLS stream wrapper

  • access: public
void setEncryption (int $enc)
  • int $enc: Level of encryption
setPassword (line 183)

Set the password for SMTP authentication

  • access: public
void setPassword (string $pass)
  • string $pass: Password to use
setPort (line 145)

Set the remote port number to connect to

  • access: public
void setPort (int $port)
  • int $port: Port number
setServer (line 124)

Set the remote server to connect to as a FQDN

  • access: public
void setServer (string $server)
  • string $server: Server name
setTimeout (line 108)

Set the timeout to connect in seconds

  • access: public
void setTimeout (int $time)
  • int $time: Timeout to use
setUsername (line 166)

Provide a username for authentication

  • access: public
void setUsername (string $user)
  • string $user: The username
smtpErrors (line 318)

Get the smtp error string as recorded by fsockopen()

  • access: public
string smtpErrors ()
start (line 276)

Try to start the connection

  • access: public
  • throws: Swift_ConnectionException Upon failure to start
void start ()
stop (line 420)

Try to close the connection

  • access: public
  • throws: Swift_ConnectionException Upon failure to close
void stop ()
write (line 265)

Write a command to the server (leave off trailing CRLF)

  • access: public
  • throws: Swift_ConnectionException Upon failure to write
void write (string $command, [ $end = "\r\n"])
  • string $command: The command to send
  • $end

Inherited Methods

Inherited From Swift_ConnectionBase

Swift_ConnectionBase::getAttributes()
Swift_ConnectionBase::getRequiresEHLO()
Swift_ConnectionBase::hasExtension()
Swift_ConnectionBase::postConnect()
Swift_ConnectionBase::setExtension()
Swift_ConnectionBase::setRequiresEHLO()
Class Constants
AUTO_DETECT = -2 (line 45)

Constant for auto-detection of paramters

ENC_OFF = 8 (line 33)

Constant for unencrypted connections

ENC_SSL = 4 (line 29)

Constant for SSL connections

ENC_TLS = 2 (line 25)

Constant for TLS connections

PORT_DEFAULT = 25 (line 37)

Constant for the default SMTP port

PORT_SECURE = 465 (line 41)

Constant for the default secure SMTP port

Documentation generated on Wed, 26 Mar 2008 20:33:11 +1100 by phpDocumentor 1.3.1