|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2023-11-12 (20 days ago) || 76%||Total: 55,369 This week: 4||All time: 3 This week: 26|
The class that connects to an SMTP mail server to send messages. It features:
- Relaying message delivery to a programmer-defined SMTP server.
- Connect to the SMTP server via a SOCKS 4 or 5 server, or an HTTP proxy
- Programmer-defined server address, server port, connection timeout, and origin host address.
- Authentication mechanisms implemented by SASL client classes like PLAIN, LOGIN, CRAM-MD5, NTLM (Windows or Linux/Unix via Samba), XOAUTH2, etc...
- Support for POP3-based authentication before delivery.
- Direct delivery to one or more recipients with e-mail addresses with the same domain, so you do not need to relay on your SMTP server or your ISP's SMTP server.
- Setting the sender and recipient address as a separate step from sending the headers and the body of the message.
- Returns message delivery success.
- Detects extensions supported by the SMTP server.
- Takes advantage of the SMTP PIPELINING extension to buffer SMTP commands, minimizing SMTP dialogue between the class and the server to provide a much faster queueing of messages to be delivered to many recipients ( bulk mail ).
* Note: this class is better in conjunction with the "MIME E-mail message composing and sending class." See in the Email group.
* @(#) $Header: /opt2/ena/metal/smtp/test_smtp.php,v 1.22 2023/11/13 03:50:17 mlemos Exp $
/* Uncomment when using SASL authentication mechanisms */
$from="email@example.com"; /* Change this to your address like "firstname.lastname@example.org"; */ $sender_line=__LINE__;
$to="email@example.com"; /* Change this to your test recipient address */ $recipient_line=__LINE__;
die("Please set the messages sender address in line ".$sender_line." of the script ".basename(__FILE__)."\n");
die("Please set the messages recipient address in line ".$recipient_line." of the script ".basename(__FILE__)."\n");
$smtp->host_name="smtp.gmail.com"; /* Change this variable to the address of the SMTP server to relay, like "smtp.myisp.com" */
$smtp->host_port=465; /* Change this variable to the port of the SMTP server to use, like 465 */
$smtp->ssl=1; /* Change this variable if the SMTP server requires an secure connection using SSL */
// $smtp->http_proxy_host_name='220.127.116.11'; /* Change this variable if you need to connect to SMTP server via an HTTP proxy */
// $smtp->http_proxy_host_port=465; /* Change this variable if you need to connect to SMTP server via an HTTP proxy */
$smtp->socks_host_name = ''; /* Change this variable if you need to connect to SMTP server via an SOCKS server */
$smtp->socks_host_port = 1080; /* Change this variable if you need to connect to SMTP server via an SOCKS server */
$smtp->socks_version = '5'; /* Change this variable if you need to connect to SMTP server via an SOCKS server */
$smtp->start_tls=0; /* Change this variable if the SMTP server requires security by starting TLS during the connection */
$smtp->cryptographic_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; /* Change this variable if the SMTP server requires the use of a specific version of SSL or TLS when establishing secure connections */
$smtp->localhost="localhost"; /* Your computer address */
$smtp->direct_delivery=0; /* Set to 1 to deliver directly to the recepient SMTP server */
$smtp->timeout=10; /* Set to the number of seconds wait for a successful connection to the SMTP server */
$smtp->data_timeout=0; /* Set to the number seconds wait for sending or retrieving data from the SMTP server.
Set to 0 to use the same defined in the timeout variable */
$smtp->debug=1; /* Set to 1 to output the communication with the SMTP server */
$smtp->html_debug=0; /* Set to 1 to format the debug output as HTML */
$smtp->pop3_auth_host=""; /* Set to the POP3 authentication host if your SMTP server requires prior POP3 authentication */
$smtp->user="firstname.lastname@example.org"; /* Set to the user name if the server requires authetication */
$smtp->realm=""; /* Set to the authetication realm, usually the authentication user e-mail domain */
$smtp->password="passgooglemail"; /* Set to the authetication password */
$smtp->workstation=""; /* Workstation name for NTLM authentication */
$smtp->authentication_mechanism=""; /* Specify a SASL authentication method like LOGIN, PLAIN, CRAM-MD5, NTLM, etc..
Leave it empty to make the class negotiate if necessary */
* If you need to use the direct delivery mode and this is running under
* Windows or any other platform that does not have enabled the MX
* resolution function GetMXRR() , you need to include code that emulates
* that function so the class knows which SMTP server it should connect
* to deliver the message directly to the recipient SMTP server.
* If possible specify in this array the address of at least on local
* DNS that may be queried from your network.
* If GetMXRR function is available but it is not functional, to use
* the direct delivery mode, you may use a replacement function.
"Subject: Testing Manuel Lemos' SMTP class",
"Date: ".date("D, d M o H:i:s e")
"Hello $to,\n\nIt is just to let you know that your SMTP class is working just fine.\n\nBye.\n"))
echo "Message sent to $to OK.\n";
echo "Could not send the message to $to.\nError: ".$smtp->error."\n";
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
||Other classes that need this package
||Why it is needed
|MIME E-mail message sending
||If it is used the SMTP message sub-class, this class is need to perform the actual SMTP delivery
||for connecting to a local/remote smtp server and sending e-mail messages
||Pages that reference this package
Latest pages that reference packages