PHP Classes

SMTP E-mail sending class: Sends e-mail messages via SMTP protocol

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (94)   Blog (2)    
Last Updated Ratings Unique User Downloads Download Rankings
2023-06-01 (3 months ago) RSS 2.0 feedStarStarStarStar 76%Total: 55,344 This week: 1All time: 3 This week: 107Down
Version License PHP version Categories
smtpclass 1.0.10BSD License3Email, Networking


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.


Send emails fast
I need to send many emails

Picture of Manuel Lemos
  Performance   Level  
Name: Manuel Lemos is available for providing paid consulting. Contact Manuel Lemos .
Classes: 45 packages by
Country: Portugal Portugal
Age: 54
All time rank: 1
Week rank: 9 Down1 in Portugal Portugal Equal

  • smtp.gif
  Files folder image Files  
File Role Description
Accessible without login Plain text file classmaps.php Aux. Class map list
Accessible without login Plain text file getmxrr.php Aux. GetMXRR function emulation need for direct delivery mode under Windows and other platforms without this function (needs DNS.php mentioned in the Related links section).
Plain text file smtp.php Class SMTP class file
Accessible without login HTML file smtp_class.html Doc. Documentation of the SMTP class
Accessible without login Plain text file test_smtp.php Example SMTP class test script
Accessible without login Plain text file test_smtp_office_365.php Example Test script to send messages via the Microsoft Office 365 SMTP server
Accessible without login Plain text file test_smtp_prepare_data.php Test Test suite script to verify whether the function to prepare message body data is working correctly 37KB
Downloadsmtpclass-2023-06-01.tar.gz 36KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Simple Authentication and Security Layer Download .zip .tar.gz Provides sasl.php class for when the SMTP server requires authentication the SASL package provides support for implementing authentication mechanisms like: PLAIN, LOGIN, CRAM-MD5, NTLM (Windows or Linux/Unix with Samba). Conditional
DNSResolver Download .zip .tar.gz If you use the direct delivery mode and are using Windows or any other platform on which the PHP function GetMXRR is not working, this class can provide an alternative Conditional
 Version Control Reuses Unique User Downloads Download Rankings  
This week:1
All time:3
This week:107Down
User Ratings User Comments (10)
 All time
Good Job Manuel.
10 years ago (sergio)
sooooooooo good
11 years ago (imedmy)
12 years ago (André Silva)
Great class, I wish every piece of code would be write like t...
12 years ago (Artur)
14 years ago (Amit kumar das)
a little hard to figure out, but works great!
15 years ago (jbarrar)
It is the ultimate solution for sending emails via SMTP throu...
15 years ago (Said Bakr)
no support for MIME messages.
15 years ago (f5inet)
excelency the Lemos way.
15 years ago (Namida)
Good is the higher rating, but excellent is the rating I want...
15 years ago (Leo)