Class Zend_Mail_Transport_Smtp

Description

SMTP connection object minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT

  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Mail/Transport/Smtp.php (line 40)

Zend_Mail_Transport_Abstract
   |
   --Zend_Mail_Transport_Smtp
Class Constant Summary
Variable Summary
 Stream $_con
 mixed $_host
 mixed $_myName
 mixed $_port
Method Summary
 Zend_Mail_Transport_Smtp __construct ([string $host = '127.0.0.1'], [int $port = null], [string $myName = '127.0.0.1'])
 void connect ()
 void data (string $data)
 void disconnect ()
 void helo (string $myname)
 void mail_from (string $from_email)
 void noop ()
 void quit ()
 void rcpt_to (string $to)
 void rset ()
 void vrfy (string $user)
 void _expect (int $val1, [int $val2 = null], [int $val3 = null])
 string _receive ()
 void _send (string $str)
 void _sendMail (array $to)
Variables
array $lastResponse = array() (line 55)

Last Response from the SMTP server, 1 Array Element per line

  • var: of strings
  • access: public
Stream $_con = null (line 62)

Stream to SMTP Server

  • access: protected
mixed $_host (line 46)
  • access: protected
mixed $_myName (line 48)
  • access: protected
mixed $_port (line 47)
  • access: protected

Inherited Variables

Inherited from Zend_Mail_Transport_Abstract

Zend_Mail_Transport_Abstract::$body
Zend_Mail_Transport_Abstract::$boundary
Zend_Mail_Transport_Abstract::$EOL
Zend_Mail_Transport_Abstract::$header
Zend_Mail_Transport_Abstract::$recipients
Zend_Mail_Transport_Abstract::$_headers
Zend_Mail_Transport_Abstract::$_isMultipart
Zend_Mail_Transport_Abstract::$_mail
Zend_Mail_Transport_Abstract::$_parts
Methods
Constructor __construct (line 71)

Constructor.

  • access: public
Zend_Mail_Transport_Smtp __construct ([string $host = '127.0.0.1'], [int $port = null], [string $myName = '127.0.0.1'])
  • string $host
  • int $port
  • string $myName: (for use with HELO)
connect (line 94)

Connect to the server with the parameters given in the constructor and send "HELO". The connection is immediately closed if an error occurs.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void connect ()
data (line 189)

sends the DATA command followed by the email content (headers plus body) folowed by a dot and validates the response of the server.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void data (string $data)
  • string $data
disconnect (line 268)

close an existing connection.

sends QUIT and closes stream.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void disconnect ()
helo (line 140)

Sends EHLO along with the given machine name and validates server response. If EHLO fails, HELO is sent for compatibility with older MTAs.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void helo (string $myname)
  • string $myname
mail_from (line 161)

sends a MAIL command for the senders address and validates the response.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void mail_from (string $from_email)
  • string $from_email
noop (line 227)

Sends the NOOP command end validates answer Not used by Zend_Mail, could be used to keep a connection alive or check if it is still open.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void noop ()
quit (line 255)

Sends the QUIT command and validates answer

  • access: public
  • throws: Zend_Mail_Transport_Exception
void quit ()
rcpt_to (line 174)

sends a RCPT command for a recipient address and validates the response.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void rcpt_to (string $to)
  • string $to
rset (line 213)

Sends the RSET command end validates answer Not used by Zend_Mail, can be used to restore a clean smtp communication state when a transaction has been cancelled.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void rset ()
vrfy (line 243)

Sends the VRFY command end validates answer The calling method needs to evaluate $this->lastResponse This function was implemented for completeness only.

It is not used by Zend_Mail.

  • access: public
  • throws: Zend_Mail_Transport_Exception
void vrfy (string $user)
  • string $user: User Name or eMail to verify
_expect (line 287)

Read the response from the stream and

check for expected return code. throws a Zend_Mail_Transport_Exception if an unexpected code is returned

  • access: protected
  • throws: Zend_Mail_Transport_Exception
void _expect (int $val1, [int $val2 = null], [int $val3 = null])
  • int $val1
  • int $val2
  • int $val3
_receive (line 324)

Get a line from the stream. includes error checking and debugging

  • access: protected
  • throws: Zend_Mail_Transport_Exception
string _receive ()
_send (line 346)

Send the given string followed by a LINEEND to the server

  • access: protected
  • throws: Zend_Mail_Transport_Exception
void _send (string $str)
  • string $str
_sendMail (line 363)

Send an email

  • access: public
void _sendMail (array $to)
  • array $to

Redefinition of:
Zend_Mail_Transport_Abstract::_sendMail()
Send an email independent from the used transport

Inherited Methods

Inherited From Zend_Mail_Transport_Abstract

 Zend_Mail_Transport_Abstract::send()
 Zend_Mail_Transport_Abstract::_buildBody()
 Zend_Mail_Transport_Abstract::_formatHeader()
 Zend_Mail_Transport_Abstract::_getHeaders()
 Zend_Mail_Transport_Abstract::_prepareHeaders()
 Zend_Mail_Transport_Abstract::_sendMail()
Class Constants
COMMUNICATION_TIMEOUT = 2 (line 43)
CONNECTION_TIMEOUT = 30 (line 42)
DEBUG = false (line 44)

Documentation generated on Thu, 18 Jan 2007 09:59:17 -0800 by phpDocumentor 1.3.1