Download the PHP package toropyga/fmail without Composer
On this page you can find all versions of the php package toropyga/fmail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download toropyga/fmail
More information about toropyga/fmail
Files in toropyga/fmail
Package fmail
Short Description Library for working with post servers from Toropyga
License MIT
Informations about the package fmail
Fmail
PHP Mail sender script
Description and usage examples for the FMail PHP class for sending and receiving mail.
Table of Contents
- Overview
- Features of the FMail class
- How it works
- Usage example
Overview
The FMail class is designed for sending and receiving email messages using PHP. This class is not a full-featured email client! It requires PHP version 4 or higher.
Features of the FMail class
Allows sending mail using the standard PHP mail() function, or, without using that function directly, connecting to a specified mail server via a socket.
Allows receiving mail using the PHP IMAP library.
Supports authorization on mail servers using the PLAIN and LOGIN methods.
Supports the ISO-8859-1, UTF-8, WINDOWS-1251, and KOI8-R text encodings (charsets).
Supports sending messages in both plain text and HTML format.
Sending a message to multiple recipients.
Supports limiting the number of recipients per message — i.e., if several recipients are specified and the recipient limit is set to 1, a separate message will be created and sent to each recipient individually.
Supports sending messages to hidden recipients, whose name and address are not shown in the "To" field.
Allows attaching files of any format to a message.
Creating a message from any HTML file, including loading images, stylesheets, and scripts.
Supports converting text from Windows-1251 encoding to UTF-8 and back, without requiring the iconv module.
Email address format validation.
Logging of all actions.
How it works
Core message-sending functions
Include the class file
or using Composer
Initialize the class
Warning!!! The class has default values. All default parameters can be changed in the "Script (class) settings variables" block, or via the special class functions described below.
By default, the script uses the PHP mail() function. To connect via a socket instead, specify:
When connecting via a socket, the default server is localhost. To change it, use:
When connecting via a socket, the default port is 25. To change it, use:
When connecting via a socket, the default socket response timeout is 10 seconds. To change it, use:
When connecting via a socket, user authorization on the server is not required by default. To change this, use:
For authorization, you must specify the user's login and password. Use the functions:
By default, the limit on the number of simultaneous message recipients is 1 (one). To change it, use:
By default, UTF-8 text encoding is used. To change it, use:
Specifying message recipients. (For more details, see the function description)
Clear the list of recipients, since the setTo function is cumulative
Specifying hidden recipients (BCC) of the message, if needed. (For more details, see the function description)
Clear the list of hidden recipients, since the setBcc function is cumulative
Specifying the message sender. (For more details, see the function description)
or
Specifying the message subject
Setting the message body.
There are 4 different functions available for setting the message body. When creating a message, choose only one, since each function does not append new text to the previously set message body — it replaces the old text with the new one!!!
-
Creating a plain text message (text/plain)
- Creating a text message in HTML format
or
-
Creating a plain text message (text/plain) from an HTML file
- Creating a message from an HTML file (returns true or false)
Adding files to the message (returns true or false)
Clear the list of files, since the setFile function is cumulative
Sending the message (returns true or false)
Core message-receiving functions
Include the class file
Initialize the class
By default, the connection uses localhost as the server. To change it, use:
When connecting via IMAP, the default port is 143. To change it, use:
The IMAP protocol is used by default for connections. POP3 can be used, but it is not recommended. To change this, use:
Setting connection flags for the imap_open function
For authorization, you must specify the user's login and password. Use the functions:
Read the list of folders.
Setting the folder to read its contents
Returns the list of messages in a folder. All parameters are optional. Specify the folder name, the message number to start reading from, and the number of messages to return (see the function description)
Returns the list of messages in the mailbox based on the specified parameters
Reading a message by message number
Reading a message by UID
Additional functions
Validating the format of an email address (returns true or false)
Converting text from Windows-1251 encoding to UTF-8
Converting text from UTF-8 encoding to Windows-1251
Enabling the script's debug functions (displays an error message on screen if one occurs)
Viewing the class logs. Pass the parameters for the logs you need. 0 - all logs, 1 - executed functions, 2 - data sent and received, 3 - errors
Decoding strings of the form =?utf-8?B?0KHQv9GA0LDQstC+0YfQvdC40Log0JHQmNCa?=
Usage example
All versions of fmail with dependencies
toropyga/base Version ^1.0.3
ext-imap Version *
ext-fileinfo Version *
ext-iconv Version *
ext-mbstring Version *