Mail: ezcMailSmtpTransport
[ ]
[ Display-example ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMailSmtpTransport
|
This class implements the Simple Mail Transfer Protocol (SMTP) with authentication support. [
source]
Implemented Interfaces
See for further information the RFC's:
Descendents
| Child Class |
Description |
| ezcMailTransportSmtp |
This class is deprecated. Use ezcMailSmtpTransport instead.
|
Constants
CRLF
= "\r\n"
|
The line-break characters to use. |
Properties
|
string |
read/write
|
$password
The password used for authentication. |
|
string |
read/write
|
$senderHost
The hostname of the computer that sends the mail. the default is 'localhost'. |
|
string |
read/write
|
$serverHost
The SMTP server host to connect to. |
|
int |
read/write
|
$serverPort
The port of the SMTP server. Defaults to 25. |
|
int |
read/write
|
$timeout
The timeout value of the connection in seconds. The default is five seconds. |
|
string |
read/write
|
$username
The username used for authentication. The default is blank which means no authentication. |
Method Summary
|
public ezcMailSmtpTransport |
__construct(
$host, [$user = ''], [$password = ''], [$port = 25] )
Constructs a new ezcMailTransportSmtp. |
|
public void |
__destruct(
)
Destructs this object. |
|
protected void |
cmdRcpt(
$email, $to )
Sends the 'RCTP TO' to the server with the address $email. |
|
public void |
disconnect(
)
Sends the QUIT command to the server and breaks the connection. |
|
public void |
keepConnection(
)
Sets if the connection should be kept open after sending an email. |
|
public void |
send(
$mail )
Sends the ezcMail $mail using the SMTP protocol. |
Methods
__construct
ezcMailSmtpTransport __construct(
string
$host, [string
$user = ''], [string
$password = ''], [int
$port = 25] )
Constructs a new ezcMailTransportSmtp.
The constructor expects, at least, the hostname $host of the SMTP server.
The username $user will be used for authentication if provided. If it is left blank no authentication will be performed.
The password $password will be used for authentication if provided. Use this parameter always in combination with the $user parameter.
The portnumber $port, default the SMTP standard port, to which will be connected.
Parameters
| Name |
Type |
Description |
$host |
string |
|
$user |
string |
|
$password |
string |
|
$port |
int |
|
__destruct
void __destruct(
)
Destructs this object.
Closes the connection if it is still open.
cmdRcpt
void cmdRcpt(
$email, string
$to )
Sends the 'RCTP TO' to the server with the address $email.
This method must be called once for each recipient of the mail including cc and bcc recipients. The RCPT TO commands control where the mail is actually sent. It does not affect the headers of the email.
The recipient mail address $email may be enclosed in angle brackets.
Parameters
| Name |
Type |
Description |
$to |
string |
|
$email |
|
|
Throws
| Class | Description |
ezcMailTransportException |
if there is no valid connection or if the RCPT TO command failed. |
disconnect
void disconnect(
)
Sends the QUIT command to the server and breaks the connection.
Throws
| Class | Description |
ezcMailTransportException |
if the QUIT command failed. |
keepConnection
void keepConnection(
)
Sets if the connection should be kept open after sending an email.
This method should be called prior to the first call to send().
Keeping the connection open is useful if you are sending a lot of mail. It removes the overhead of opening the connection after each mail is sent.
Use disconnect() to close the connection if you have requested to keep it open.
send
Sends the ezcMail $mail using the SMTP protocol.
If you want to send several emails use keepConnection() to leave the connection to the server open between each mail.
Parameters
| Name |
Type |
Description |
$mail |
ezcMail |
|
Throws
| Class | Description |
ezcMailTransportException |
if the mail could not be sent. |
Last updated: Thu, 01 Nov 2007