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

Class: Mail2_smtpmx

Source Location: /Mail2-0.1.1/Mail2/smtpmx.php

Class Overview

Mail2
   |
   --Mail2_smtpmx

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


Author(s):

Version:

  • $Revision$

Variables

Methods


Inherited Variables

Inherited Methods

Class: Mail2

Mail2::factory()
Provides an interface for generating Mail:: objects of various types
Mail2::parseRecipients()
Take a set of recipients and parse them, returning an array of bare addresses (forward paths) that can be passed to sendmail or an smtp server with the rcpt to: command.
Mail2::prepareHeaders()
Take an array of mail headers and return a string containing text usable in sending a message.
Mail2::send()
Implements Mail::send() function using php's built-in mail() command.
Mail2::_sanitizeHeaders()
Sanitize an array of mail headers by removing any additional header strings present in a legitimate header's value. The goal of this filter is to prevent mail injection attacks.

Class Details

[line 60]
SMTP MX implementation of the PEAR Mail interface. Requires the Net_SMTP2 class.


[ Top ]


Class Variables

$debug =  false

[line 133]

Turn on Net_SMTP2 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_SMTP2 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 147]

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 83]

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

Type:   string


[ Top ]

$port =  25

[line 74]

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

Type:   integer


[ Top ]

$resolver =

[line 104]

PEAR:Net_DNS_Resolver

Type:   object


[ Top ]

$test =  false

[line 126]

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

Type:   boolean


[ Top ]

$timeout =  10

[line 90]

SMTP connection timeout value. NULL indicates no timeout.

Type:   integer


[ Top ]

$verp =  false

[line 112]

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 119]

Whether to use VRFY or not.

Type:   boolean


[ Top ]

$withNetDns =  true

[line 97]

use either PEAR:Net_DNS or getmxrr

Type:   boolean


[ Top ]

$_smtp =  null

[line 67]

SMTP connection object.
  • Access: protected

Type:   object


[ Top ]



Method Detail

__construct (Constructor)   [line 211]

Mail2_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 241]

void __destruct( )

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

[ Top ]

send   [line 257]

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 Mail2::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 ]

_getMx   [line 389]

mixed _getMx( string $host)

Recieve mx rexords for a spciefied host

The MX records

  • Return: sorted
  • Access: protected

Parameters:

string   $host   —  mail host

[ Top ]

_loadNetDns   [line 430]

boolean _loadNetDns( )

initialize PEAR:Net_DNS_Resolver
  • Return: true on success
  • Access: protected

[ Top ]

_raiseError   [line 457]

void _raiseError( string $id, [array $info = array()])

raise standardized error

include additional information in error message

  • See: _errorCode
  • Access: protected

Parameters:

string   $id   —  maps error ids to codes and message
array   $info   —  optional information in associative array

[ Top ]


Documentation generated on Mon, 11 Mar 2019 16:04:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.