Net_SMTP
[ class tree: Net_SMTP ] [ index: Net_SMTP ] [ all elements ]

Class: Net_SMTP

Source Location: /Net_SMTP-1.6.2/Net/SMTP.php

Class Overview


Provides an implementation of the SMTP protocol using PEAR's Net_Socket:: class.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 35]
Provides an implementation of the SMTP protocol using PEAR's Net_Socket:: class.


[ Top ]


Class Variables

$auth_methods = array()

[line 63]

List of supported authentication methods, in preferential order.
  • Access: public

Type:   array


[ Top ]

$host =  'localhost'

[line 42]

The server to connect to.
  • Access: public

Type:   string


[ Top ]

$localhost =  'localhost'

[line 56]

The value to give when sending EHLO or HELO.
  • Access: public

Type:   string


[ Top ]

$pipelining =  false

[line 76]

Use SMTP command pipelining (specified in RFC 2920) if the SMTP server supports it.

When pipeling is enabled, rcptTo(), mailFrom(), sendFrom(), somlFrom() and samlFrom() do not wait for a response from the SMTP server but return immediately.

  • Access: public

Type:   bool


[ Top ]

$port =  25

[line 49]

The port to connect to.
  • Access: public

Type:   int


[ Top ]



Method Detail

Net_SMTP (Constructor)   [line 170]

Net_SMTP Net_SMTP( [string $host = null], [integer $port = null], [string $localhost = null], [ $pipelining = false], [integer $timeout = 0], [array $socket_options = null], boolean $pipeling)

Instantiates a new Net_SMTP object, overriding any defaults with parameters that are passed in.

If you have SSL support in PHP, you can connect to a server over SSL using an 'ssl://' prefix:

// 465 is a common smtps port. $smtp = new Net_SMTP('ssl://mail.host.com', 465); $smtp->connect();

  • Since: 1.0
  • Access: public

Parameters:

string   $host     The server to connect to.
integer   $port     The port to connect to.
string   $localhost     The value to give when sending EHLO or HELO.
boolean   $pipeling     Use SMTP command pipelining
integer   $timeout     Socket I/O timeout in seconds.
array   $socket_options     Socket stream_context_create() options.
   $pipelining     

[ Top ]

auth   [line 586]

mixed auth( string $uid, string $pwd, [string $method = ''], [bool $tls = true], [string $authz = ''])

Attempt to do SMTP authentication.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

string   $uid     The userid to authenticate as.
string   $pwd     The password to authenticate with.
string   $method     The requested authentication method. If none is specified, the best supported method will be used.
bool   $tls     Flag indicating whether or not TLS should be attempted.
string   $authz     An optional authorization identifier. If specified, this identifier will be used as the authorization proxy.

[ Top ]

command   [line 388]

mixed command( string $command, mixed $valid)

Issue an SMTP command and verify its response.
  • Return: True on success or a PEAR_Error object on failure.
  • Since: 1.6.0
  • Access: public

Parameters:

string   $command     The SMTP command string or data.
mixed   $valid     The set of valid response codes. These may be specified as an array of integer values or as a single integer value.

[ Top ]

connect   [line 442]

mixed connect( [int $timeout = null], [bool $persistent = false])

Attempt to connect to the SMTP server.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

int   $timeout     The timeout value (in seconds) for the socket connection attempt.
bool   $persistent     Should a persistent socket connection be used?

[ Top ]

data   [line 1021]

mixed data( mixed $data, [string $headers = null])

Send the DATA command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

mixed   $data     The message data, either as a string or an open file resource.
string   $headers     The message headers. If $headers is provided, $data is assumed to contain only body data.

[ Top ]

disconnect   [line 487]

mixed disconnect( )

Attempt to disconnect from the SMTP server.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

[ Top ]

getGreeting   [line 424]

string getGreeting( )

Return the SMTP server's greeting string.
  • Return: A string containing the greeting string, or null if a greeting has not been received.
  • Since: 1.3.3
  • Access: public

[ Top ]

getResponse   [line 410]

array getResponse( )

Return a 2-tuple containing the last response from the SMTP server.
  • Return: A two-element array: the first element contains the response code as an integer and the second element contains the response's arguments as a string.
  • Since: 1.1.0
  • Access: public

[ Top ]

getServiceExtensions   [line 903]

array getServiceExtensions( )

Return the list of SMTP service extensions advertised by the server.
  • Return: The list of SMTP service extensions.
  • Since: 1.3
  • Access: public

[ Top ]

helo   [line 884]

mixed helo( string $domain)

Send the HELO command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

string   $domain     The domain name to say we are.

[ Top ]

identifySender   [line 1328]

boolean identifySender( )

Backwards-compatibility method. identifySender()'s functionality is now handled internally.
  • Return: This method always return true.
  • Since: 1.0
  • Access: public

[ Top ]

mailFrom   [line 927]

mixed mailFrom( string $sender, [string $params = null])

Send the MAIL FROM: command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

string   $sender     The sender (reverse path) to set.
string   $params     

String containing additional MAIL parameters, such as the NOTIFY flags defined by RFC 1891 or the VERP protocol.

If $params is an array, only the 'verp' option is supported. If 'verp' is true, the XVERP parameter is appended to the MAIL command. If the 'verp' value is a string, the full XVERP=value parameter is appended.


[ Top ]

noop   [line 1307]

mixed noop( )

Send the NOOP command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

[ Top ]

quotedata   [line 998]

void quotedata( &$data, string $data)

Quote the data so that it meets SMTP standards.

This is provided as a separate public function to facilitate easier overloading for the cases where it is desirable to customize the quoting behavior.

  • Since: 1.2
  • Access: public

Parameters:

string   $data     The message text to quote. The string must be passed by reference, and the text will be modified in place.
   &$data     

[ Top ]

rcptTo   [line 968]

mixed rcptTo( string $recipient, [string $params = null])

Send the RCPT TO: command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

string   $recipient     The recipient (forward path) to add.
string   $params     String containing additional RCPT parameters, such as the NOTIFY flags defined by RFC 1891.

[ Top ]

rset   [line 1264]

mixed rset( )

Send the RSET command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

[ Top ]

samlFrom   [line 1227]

mixed samlFrom( string $path)

Send the SAML FROM: command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.2.6
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

saml_from   [line 1251]

mixed saml_from( string $path)

Backwards-compatibility wrapper for samlFrom().
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Deprecated: 1.2.6
  • Since: 1.0
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

sendFrom   [line 1149]

mixed sendFrom( string $path)

Send the SEND FROM: command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.2.6
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

send_from   [line 1173]

mixed send_from( string $path)

Backwards-compatibility wrapper for sendFrom().
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Deprecated: 1.2.6
  • Since: 1.0
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

setAuthMethod   [line 671]

mixed setAuthMethod( string $name, mixed $callback, [bool $prepend = true])

Add a new authentication method.
  • Return: True on success or a PEAR_Error object on failure.
  • Since: 1.6.0
  • Access: public

Parameters:

string   $name     The authentication method name (e.g. 'PLAIN')
mixed   $callback     The authentication callback (given as the name of a function or as an (object, method name) array).
bool   $prepend     Should the new method be prepended to the list of available methods? This is the default behavior, giving the new method the highest priority.

[ Top ]

setDebug   [line 221]

void setDebug( boolean $debug, [ $handler = null])

Set the value of the debugging flag.
  • Since: 1.1.0
  • Access: public

Parameters:

boolean   $debug     New value for the debugging flag.
   $handler     

[ Top ]

setTimeout   [line 209]

void setTimeout( integer $seconds, [integer $microseconds = 0])

Set the socket I/O timeout value in seconds plus microseconds.
  • Since: 1.5.0
  • Access: public

Parameters:

integer   $seconds     Timeout value in seconds.
integer   $microseconds     Additional value in microseconds.

[ Top ]

somlFrom   [line 1188]

mixed somlFrom( string $path)

Send the SOML FROM: command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.2.6
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

soml_from   [line 1212]

mixed soml_from( string $path)

Backwards-compatibility wrapper for somlFrom().
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Deprecated: 1.2.6
  • Since: 1.0
  • Access: public

Parameters:

string   $path     The reverse path to send.

[ Top ]

vrfy   [line 1286]

mixed vrfy( string $string)

Send the VRFY command.
  • Return: Returns a PEAR_Error with an error message on any kind of failure, or true on success.
  • Since: 1.0
  • Access: public

Parameters:

string   $string     The string to verify

[ Top ]


Documentation generated on Fri, 05 Jul 2013 00:30:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.