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

Class: Mail_smtpmx

Source Location: /Mail-1.2.0/Mail/smtpmx.php

Class Overview

Mail
   |
   --Mail_smtpmx

SMTP MX implementation of the PEAR Mail interface. Requires the Net_SMTP class.


Author(s):

Version:

  • $Revision: 294747 $

Variables

Methods


Inherited Variables

Class: Mail

Mail::$sep

Inherited Methods

Class: Mail

Mail::factory()
Provides an interface for generating Mail:: objects of various types
Mail::send()
Implements Mail::send() function using php's built-in mail() command.

Class Details

[line 61]
SMTP MX implementation of the PEAR Mail interface. Requires the Net_SMTP class.
  • Author: gERD Schaufelberger <gerd@php-tools.net>
  • Version: $Revision: 294747 $
  • Access: public


[ Top ]


Class Variables

$debug =  false

[line 135]

Turn on Net_SMTP debugging?

Type:   boolean


[ Top ]

$errorCode = array(
        'not_connected' => array(
            'code'  => 1,
            'msg'   => 'Could not connect to any mail server ({HOST}) at port {PORT} to send mail to {RCPT}.'
        ),'failed_vrfy_rcpt'=>array('code'=>2,'msg'=>'Recipient "{RCPT}" could not be veryfied.'),'failed_set_from'=>array('code'=>3,'msg'=>'Failed to set sender: {FROM}.'),'failed_set_rcpt'=>array('code'=>4,'msg'=>'Failed to set recipient: {RCPT}.'),'failed_send_data'=>array('code'=>5,'msg'=>'Failed to send mail to: {RCPT}.'),'no_from'=>array('code'=>5,'msg'=>'No from address has be provided.'),'send_data'=>array('code'=>7,'msg'=>'Failed to create Net_SMTP object.'),'no_mx'=>array('code'=>8,'msg'=>'No MX-record for {RCPT} found.'),'no_resolver'=>array('code'=>9,'msg'=>'Could not start resolver! Install PEAR:Net_DNS or switch off "netdns"'),'failed_rset'=>array('code'=>10,'msg'=>'RSET command failed, SMTP-connection corrupt.'),)

[line 149]

internal error codes

translate internal error identifier to PEAR-Error codes and human readable messages.

  • Todo: as I need unique error-codes to identify what exactly went wrond I did not use intergers as it should be. Instead I added a "namespace" for each code. This avoids conflicts with error codes from different classes. How can I use unique error codes and stay conform with PEAR?

Type:   boolean


[ Top ]

$mailname =  'localhost'

[line 85]

Hostname or domain that will be sent to the remote SMTP server in the HELO / EHLO message.

Type:   string


[ Top ]

$port =  25

[line 76]

The port the SMTP server is on.
  • See: getservicebyname()

Type:   integer


[ Top ]

$resolver =

[line 106]

PEAR:Net_DNS_Resolver

Type:   object


[ Top ]

$test =  false

[line 128]

Switch to test mode - don't send emails for real

Type:   boolean


[ Top ]

$timeout =  10

[line 92]

SMTP connection timeout value. NULL indicates no timeout.

Type:   integer


[ Top ]

$verp =  false

[line 114]

Whether to use VERP or not. If not a boolean, the string value will be used as the VERP separators.
  • Var: boolean or string

Type:   mixed


[ Top ]

$vrfy =  false

[line 121]

Whether to use VRFY or not.

Type:   boolean


[ Top ]

$withNetDns =  true

[line 99]

use either PEAR:Net_DNS or getmxrr

Type:   boolean


[ Top ]



Method Detail

Mail_smtpmx (Constructor)   [line 247]

Mail_smtpmx Mail_smtpmx( array $params)

Constructor wrapper for PHP4

Parameters:

array   $params     Hash containing any parameters different from the defaults

[ Top ]

__construct (Constructor)   [line 214]

Mail_smtpmx __construct( array $params)

Constructor.

Instantiates a new Mail_smtp:: object based on the parameters passed in. It looks for the following parameters: mailname The name of the local mail system (a valid hostname which matches the reverse lookup) port smtp-port - the default comes from getservicebyname() and should work fine timeout The SMTP connection timeout. Defaults to 30 seconds. vrfy Whether to use VRFY or not. Defaults to false. verp Whether to use VERP or not. Defaults to false. test Activate test mode? Defaults to false. debug Activate SMTP and Net_DNS debug mode? Defaults to false. netdns whether to use PEAR:Net_DNS or the PHP build in function getmxrr, default is true

If a parameter is present in the $params array, it replaces the default.

  • See: _Mail_smtpmx()
  • Access: public

Parameters:

array   $params     Hash containing any parameters different from the defaults.

[ Top ]

__destruct (Destructor)   [line 257]

void __destruct( )

Destructor implementation to ensure that we disconnect from any potentially-alive persistent SMTP connections.

[ Top ]

send   [line 274]

mixed send( mixed $recipients, array $headers, string $body)

Implements Mail::send() function using SMTP direct delivery
  • Return: Returns true on success, or a PEAR_Error
  • Access: public

Overrides Mail::send() (Implements Mail::send() function using php's built-in mail() command.)

Parameters:

mixed   $recipients     in RFC822 style or array
array   $headers     The array of headers to send with the mail.
string   $body     The full text of the message body,

[ Top ]


Documentation generated on Mon, 01 Mar 2010 13:00:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.