70 lines
2.1 KiB
Markdown
70 lines
2.1 KiB
Markdown
# [ImapMailMerge](https://gitea.dubtempo.com/NP/ImapMailMerge)
|
|
|
|
Program for simulating the effect of "mail merge" for IMAP emails. The program uses the _"Reply-To:"_ header
|
|
to send individual messages to one or more recipients. This helps address issues with deliverability when
|
|
there are many _CC_ or _TO_ addresses, or when _To_ and _From_ are the same, with many _CC_ addresses.
|
|
|
|
*note -- this program might not be able to send to non-local address on **shared hosting**.
|
|
|
|
<br \>
|
|
|
|
## Requirements
|
|
|
|
Make sure all dependencies have been installed before using this program:
|
|
|
|
* [PHP](https://www.php.net/) ~ tested on PHP 7.4
|
|
* Mailserver with IMAP connectivity (can be remote)
|
|
|
|
<br \>
|
|
|
|
## Project Installation
|
|
|
|
Install this program via git pull:
|
|
|
|
```shell
|
|
$ git clone https://gitea.dubtempo.com/NP/ImapMailMerge.git
|
|
```
|
|
|
|
<br \>
|
|
|
|
## Project Usage
|
|
|
|
To use this program, complete the following steps.
|
|
|
|
1. Copy the sample config file "_config/config.ini.example_" to "_config/config.ini_".
|
|
|
|
1. Update the variables in the config file: _config/config.ini_.
|
|
|
|
1. Be sure to use the "whitelist" in the config for addresses you'd like to be able use the mailmerge.
|
|
|
|
1. Run the program manually or by referencing it via cronjob.
|
|
|
|
<br />
|
|
|
|
## How it works
|
|
|
|
Here's a basic overview of how the code works.
|
|
|
|
1. Emails are sent to the mailmerge account, eg: mailmerge@example.com.
|
|
|
|
1. When the program is called (eg: via cronjob), the INBOX is searched for new messages.
|
|
|
|
1. Messages in the INBOX are processed in the following way:
|
|
|
|
1. The FROM address is verified against the whitelist.
|
|
|
|
1. A new IMAP directory is made based on the sender's name.
|
|
|
|
1. Sub directories are also made for that sender: Error / Fail / Success.
|
|
|
|
1. Intended recipients are deduced from the Reply-To addresses specified in the message.
|
|
|
|
1. Messages are then sent via php mail().
|
|
|
|
1. Upon completion, the message is moved to the appropriate IMAP directory based on the outcome of the mail() attempt.
|
|
|
|
<br />
|
|
|
|
## Debugging
|
|
|
|
You can debug this code by looking at the error logs. Uncomment the logging lines in ImapMailMerge.php for more info. |