Migrated away from PHP Mail Parser to the new WebKlex PHP IMAP Mail Parser this will open the way to support OAUTH2 for Mail servers such as Microsoft 365 and Google Workspaces

This commit is contained in:
johnnyq
2024-06-12 15:39:52 -04:00
parent d64a7ce31e
commit 779527cf6a
218 changed files with 14781 additions and 2722 deletions

2
plugins/php-imap/.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
ko_fi: webklex
custom: ['https://www.buymeacoffee.com/webklex']

View File

@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**Used config**
Please provide the used config, if you are not using the package default config.
**Code to Reproduce**
The troubling code section which produces the reported bug.
```php
echo "Bug";
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop / Server (please complete the following information):**
- OS: [e.g. Debian 10]
- PHP: [e.g. 5.5.9]
- Version [e.g. v2.3.1]
- Provider [e.g. Gmail, Outlook, Dovecot]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,12 @@
---
name: General help request
about: Feel free to ask about any project related stuff
---
Please be aware that these issues will be closed if inactive for more then 14 days.
Also make sure to use https://github.com/Webklex/php-imap/issues/new?template=bug_report.md if you want to report a bug
or https://github.com/Webklex/php-imap/issues/new?template=feature_request.md if you want to suggest a feature.
Still here? Well clean this out and go ahead :)

View File

@@ -0,0 +1,23 @@
FROM ubuntu:latest
LABEL maintainer="Webklex <github@webklex.com>"
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y sudo dovecot-imapd
ENV LIVE_MAILBOX=true
ENV LIVE_MAILBOX_HOST=mail.example.local
ENV LIVE_MAILBOX_PORT=993
ENV LIVE_MAILBOX_ENCRYPTION=ssl
ENV LIVE_MAILBOX_VALIDATE_CERT=true
ENV LIVE_MAILBOX_USERNAME=root@example.local
ENV LIVE_MAILBOX_PASSWORD=foobar
ENV LIVE_MAILBOX_QUOTA_SUPPORT=true
EXPOSE 993
ADD dovecot_setup.sh /root/dovecot_setup.sh
RUN chmod +x /root/dovecot_setup.sh
CMD ["/bin/bash", "-c", "/root/dovecot_setup.sh && tail -f /dev/null"]

View File

@@ -0,0 +1,63 @@
#!/bin/sh
set -ex
sudo apt-get -q update
sudo apt-get -q -y install dovecot-imapd
{
echo "127.0.0.1 $LIVE_MAILBOX_HOST"
} | sudo tee -a /etc/hosts
SSL_CERT="/etc/ssl/certs/dovecot.crt"
SSL_KEY="/etc/ssl/private/dovecot.key"
sudo openssl req -new -x509 -days 3 -nodes \
-out "$SSL_CERT" \
-keyout "$SSL_KEY" \
-subj "/C=EU/ST=Europe/L=Home/O=Webklex/OU=Webklex DEV/CN=""$LIVE_MAILBOX_HOST"
sudo chown root:dovecot "$SSL_CERT" "$SSL_KEY"
sudo chmod 0440 "$SSL_CERT"
sudo chmod 0400 "$SSL_KEY"
DOVECOT_CONF="/etc/dovecot/local.conf"
MAIL_CONF="/etc/dovecot/conf.d/10-mail.conf"
IMAP_CONF="/etc/dovecot/conf.d/20-imap.conf"
QUOTA_CONF="/etc/dovecot/conf.d/90-quota.conf"
sudo touch "$DOVECOT_CONF" "$MAIL_CONF" "$IMAP_CONF" "$QUOTA_CONF"
sudo chown root:dovecot "$DOVECOT_CONF" "$MAIL_CONF" "$IMAP_CONF" "$QUOTA_CONF"
sudo chmod 0640 "$DOVECOT_CONF" "$MAIL_CONF" "$IMAP_CONF" "$QUOTA_CONF"
{
echo "ssl = required"
echo "disable_plaintext_auth = yes"
echo "ssl_cert = <""$SSL_CERT"
echo "ssl_key = <""$SSL_KEY"
echo "ssl_protocols = !SSLv2 !SSLv3"
echo "ssl_cipher_list = AES128+EECDH:AES128+EDH"
} | sudo tee -a "$DOVECOT_CONF"
{
echo "mail_plugins = \$mail_plugins quota"
} | sudo tee -a "$MAIL_CONF"
{
echo "protocol imap {"
echo " mail_plugins = \$mail_plugins imap_quota"
echo "}"
} | sudo tee -a "$IMAP_CONF"
{
echo "plugin {"
echo " quota = maildir:User quota"
echo " quota_rule = *:storage=1G"
echo "}"
} | sudo tee -a "$QUOTA_CONF"
sudo useradd --create-home --shell /bin/false "$LIVE_MAILBOX_USERNAME"
echo "$LIVE_MAILBOX_USERNAME"":""$LIVE_MAILBOX_PASSWORD" | sudo chpasswd
sudo service dovecot restart
sudo doveadm auth test -x service=imap "$LIVE_MAILBOX_USERNAME" "$LIVE_MAILBOX_PASSWORD"

View File

@@ -0,0 +1,50 @@
name: Tests
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['8.0', 8.1, 8.2]
name: PHP ${{ matrix.php }}
env:
LIVE_MAILBOX: true
LIVE_MAILBOX_DEBUG: true
LIVE_MAILBOX_HOST: mail.example.local
LIVE_MAILBOX_PORT: 993
LIVE_MAILBOX_USERNAME: root@example.local
LIVE_MAILBOX_ENCRYPTION: ssl
LIVE_MAILBOX_PASSWORD: foobar
LIVE_MAILBOX_QUOTA_SUPPORT: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: openssl, json, mbstring, iconv, fileinfo, libxml, zip
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- run: "sh .github/docker/dovecot_setup.sh"
- name: Execute tests
run: vendor/bin/phpunit