summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-10-16 08:09:21 +0200
committerRemi Collet <remi@php.net>2025-10-16 08:09:21 +0200
commit5403a7e9b38a83bb830d1a7a608f7133f5ce9991 (patch)
tree16e79375200990e1e464fd32d42a39dfb3af77c6
dup v6
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--PHPMailerRpmTest.php41
-rw-r--r--composer.json80
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-phpmailer7-layout.patch11
-rw-r--r--php-phpmailer7.spec336
7 files changed, 509 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/PHPMailerRpmTest.php b/PHPMailerRpmTest.php
new file mode 100644
index 0000000..979033a
--- /dev/null
+++ b/PHPMailerRpmTest.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * PHPMailer - RPM language file tests.
+ */
+
+namespace PHPMailer\Test;
+
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Check language files for RPM packaging
+ */
+final class PHPMailerRpmTest extends TestCase
+{
+ /**
+ * Holds a PHPMailer instance.
+ *
+ * @var PHPMailer
+ */
+ private $Mail;
+
+ /**
+ * Run before each test is started.
+ */
+ protected function setUp(): void
+ {
+ $this->Mail = new PHPMailer();
+ }
+
+ public function testTranslation()
+ {
+ $this->Mail->setLanguage();
+ $tr = $this->Mail->getTranslations();
+ $this->assertEquals('Message body empty', $tr['empty_message'], "English message");
+
+ $this->Mail->setLanguage('fr');
+ $tr = $this->Mail->getTranslations();
+ $this->assertEquals('Corps du message vide.', $tr['empty_message'], "French message");
+ }
+}
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..7b008b7
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,80 @@
+{
+ "name": "phpmailer/phpmailer",
+ "type": "library",
+ "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
+ "authors": [
+ {
+ "name": "Marcus Bointon",
+ "email": "phpmailer@synchromedia.co.uk"
+ },
+ {
+ "name": "Jim Jagielski",
+ "email": "jimjag@gmail.com"
+ },
+ {
+ "name": "Andy Prevost",
+ "email": "codeworxtech@users.sourceforge.net"
+ },
+ {
+ "name": "Brent R. Matzelle"
+ }
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/Synchro",
+ "type": "github"
+ }
+ ],
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ },
+ "lock": false
+ },
+ "require": {
+ "php": ">=5.5.0",
+ "ext-ctype": "*",
+ "ext-filter": "*",
+ "ext-hash": "*"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "doctrine/annotations": "^1.2.6 || ^1.13.3",
+ "php-parallel-lint/php-console-highlighter": "^1.0.0",
+ "php-parallel-lint/php-parallel-lint": "^1.3.2",
+ "phpcompatibility/php-compatibility": "^9.3.5",
+ "roave/security-advisories": "dev-latest",
+ "squizlabs/php_codesniffer": "^3.7.2",
+ "yoast/phpunit-polyfills": "^1.0.4"
+ },
+ "suggest": {
+ "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
+ "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
+ "ext-openssl": "Needed for secure SMTP sending and DKIM signing",
+ "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
+ "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+ "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+ "psr/log": "For optional PSR-3 debug logging",
+ "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
+ "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
+ },
+ "autoload": {
+ "psr-4": {
+ "PHPMailer\\PHPMailer\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "PHPMailer\\Test\\": "test/"
+ }
+ },
+ "license": "LGPL-2.1-only",
+ "scripts": {
+ "check": "./vendor/bin/phpcs",
+ "test": "./vendor/bin/phpunit --no-coverage",
+ "coverage": "./vendor/bin/phpunit",
+ "lint": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
+ ]
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..a5cf904
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n"
+
+echo "Cloning..."
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
+
diff --git a/php-phpmailer7-layout.patch b/php-phpmailer7-layout.patch
new file mode 100644
index 0000000..b23da87
--- /dev/null
+++ b/php-phpmailer7-layout.patch
@@ -0,0 +1,11 @@
+diff -up ./src/PHPMailer.php.rpm ./src/PHPMailer.php
+--- ./src/PHPMailer.php.rpm 2021-09-01 12:46:30.267656729 +0200
++++ ./src/PHPMailer.php 2021-09-01 12:47:43.003485872 +0200
+@@ -2253,6 +2253,7 @@ class PHPMailer
+ if (empty($lang_path)) {
+ //Calculate an absolute path so it can work if CWD is not here
+ $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
++ $lang_path = __DIR__ . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
+ }
+
+ //Validate $langcode
diff --git a/php-phpmailer7.spec b/php-phpmailer7.spec
new file mode 100644
index 0000000..5e45cda
--- /dev/null
+++ b/php-phpmailer7.spec
@@ -0,0 +1,336 @@
+# remirepo/fedora spec file for php-phpmailer6
+#
+# SPDX-FileCopyrightText: Copyright 2017-2025 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+#
+# Please preserve changelog entries
+#
+# Github
+%global gh_commit d1ac35d784bf9f5e61b424901d5a014967f15b12
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner PHPMailer
+%global gh_project PHPMailer
+# Packagist
+%global pk_vendor phpmailer
+%global pk_project phpmailer
+# Namespace
+%global ns_vendor PHPMailer
+%global ns_project PHPMailer
+# don't change major version used in package name
+%global major 6
+%bcond_without tests
+%global php_home %{_datadir}/php
+
+Name: php-%{pk_project}%{major}
+Version: 6.12.0
+Release: 1%{?dist}
+Summary: Full-featured email creation and transfer class for PHP
+
+License: LGPL-2.1-only
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# git snapshot to get upstream test suite
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+# Simple unit test for packaging
+Source2: PHPMailerRpmTest.php
+
+# Fix path to match RPM installation layout
+Patch0: %{name}-layout.patch
+
+BuildArch: noarch
+%if %{with tests}
+BuildRequires: php(language) >= 5.5
+BuildRequires: php-ctype
+BuildRequires: php-intl
+BuildRequires: php-mbstring
+BuildRequires: php-openssl
+BuildRequires: php-fedora-autoloader-devel
+# From composer.json, "require-dev": {
+# "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+# "doctrine/annotations": "^1.236 || ^1.13.3",
+# "php-parallel-lint/php-console-highlighter": "^0.5.0",
+# "php-parallel-lint/php-parallel-lint": "^1.3.1",
+# "phpcompatibility/php-compatibility": "^9.3.5",
+# "roave/security-advisories": "dev-latest",
+# "squizlabs/php_codesniffer": "^3.7.2",
+# "yoast/phpunit-polyfills": "^1.0.4"
+%global phpunit %{_bindir}/phpunit9
+BuildRequires: (php-composer(yoast/phpunit-polyfills) >= 1.0.4 with php-composer(yoast/phpunit-polyfills) < 2)
+BuildRequires: %{phpunit}
+BuildRequires: %{_sbindir}/smtp-sink
+%endif
+
+# From composer.json, "require": {
+# "require": {
+# "php": ">=5.5.0",
+# "ext-ctype": "*",
+# "ext-filter": "*",
+# "ext-hash": "*"
+Requires: php(language) >= 5.5
+Requires: php-ctype
+# from phpcompatinfo report on version 6.1.3
+Recommends: php-imap
+Requires: php-intl
+Requires: php-mbstring
+Requires: php-openssl
+# From composer.json, "suggest": {
+# "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
+# "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
+# "ext-openssl": "Needed for secure SMTP sending and DKIM signing",
+# "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
+# "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+# "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+# "psr/log": "For optional PSR-3 debug logging",
+# "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
+# "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
+Suggests: php-composer(psr/log)
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+PHPMailer - A full-featured email creation and transfer class for PHP
+
+Class Features
+* Probably the world's most popular code for sending email from PHP!
+* Used by many open-source projects:
+ WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
+* Integrated SMTP support - send without a local mail server
+* Send emails with multiple To, CC, BCC and Reply-to addresses
+* Multipart/alternative emails for mail clients that do not read HTML email
+* Add attachments, including inline
+* Support for UTF-8 content and 8bit, base64, binary, and quoted-printable
+ encodings
+* SMTP authentication with LOGIN, PLAIN, CRAM-MD5 and XOAUTH2 mechanisms
+ over SSL and SMTP+STARTTLS transports
+* Validates email addresses automatically
+* Protect against header injection attacks
+* Error messages in 47 languages!
+* DKIM and S/MIME signing support
+* Compatible with PHP 5.5 and later
+* Namespaced to prevent name clashes
+* Much more!
+
+
+Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+%patch -P0 -p1 -b .rpm
+find src -name \*.rpm -delete
+
+cp %{SOURCE2} test/PHPMailerRpmTest.php
+
+cat << 'EOF' | tee src/autoload.php
+<?php
+require_once '%{php_home}/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('PHPMailer\\PHPMailer\\', __DIR__);
+\Fedora\Autoloader\Dependencies::optional(array(
+ '%{php_home}/Psr/Log/autoload.php',
+));
+EOF
+
+
+%build
+# Empty build section, most likely nothing required.
+
+
+%install
+mkdir -p %{buildroot}/%{php_home}/%{ns_vendor}
+cp -pr src %{buildroot}/%{php_home}/%{ns_vendor}/%{ns_project}%{major}
+cp -pr language %{buildroot}/%{php_home}/%{ns_vendor}/%{ns_project}%{major}/language
+
+
+%check
+%if %{with tests}
+: Use installed tree and autoloader
+mkdir vendor
+cat << 'EOF' | tee -a vendor/autoload.php
+<?php
+require_once '%{buildroot}/%{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+require_once '%{php_home}/Yoast/PHPUnitPolyfills/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('PHPMailer\\Test\\', dirname(__DIR__) . '/test');
+EOF
+
+sed -e '/colors/d;s/logging/nologging/' phpunit.xml.dist > phpunit.xml
+
+: Start fake MTA and test environment
+PORT=$(expr 2500 + %{?fedora}%{?rhel})
+sed -e "s/2500/$PORT/" test/testbootstrap-dist.php > test/testbootstrap.php
+
+mkdir -p build/logs
+chmod +x test/fakesendmail.sh
+
+pushd build
+ smtp-sink -d "%%d.%%H.%%M.%%S" localhost:$PORT 1000 &>/dev/null &
+ SMTPPID=$!
+popd
+
+: Run upstream test suite
+ret=0
+for cmd in php php81 php82 php83 php84 php85; do
+ if which $cmd; then
+ $cmd -d "sendmail_path=$PWD/test/fakesendmail.sh -t -i " \
+ %{phpunit} \
+ --exclude slow,pop3,languages \
+%if 0%{?fedora} >= 43
+ --filter '^((?!(testSigning|testSigningWithCA)).)*$' \
+%endif
+ || ret=1
+ fi
+done
+
+: Cleanup
+kill $SMTPPID
+
+exit $ret
+%endif
+
+
+%files
+%license LICENSE
+%license COMMITMENT
+%doc *.md
+%doc examples
+%doc composer.json
+%{php_home}/%{ns_vendor}
+
+
+%changelog
+* Thu Oct 16 2025 Remi Collet <remi@remirepo.net> - 6.12.0-1
+- update to 6.12.0
+
+* Tue Sep 30 2025 Remi Collet <remi@remirepo.net> - 6.11.1-1
+- update to 6.11.1
+
+* Tue Sep 30 2025 Remi Collet <remi@remirepo.net> - 6.11.0-1
+- update to 6.11.0
+
+* Thu Jun 26 2025 Remi Collet <remi@remirepo.net> - 6.10.0-2
+- use phpunit9
+
+* Mon Apr 28 2025 Remi Collet <remi@remirepo.net> - 6.10.0-1
+- update to 6.10.0
+- re-license spec file to CECILL-2.1
+
+* Mon Nov 25 2024 Remi Collet <remi@remirepo.net> - 6.9.3-1
+- update to 6.9.3
+
+* Wed Oct 9 2024 Remi Collet <remi@remirepo.net> - 6.9.2-1
+- update to 6.9.2
+
+* Fri Aug 30 2024 Remi Collet <remi@remirepo.net> - 6.9.1-6
+- fix build dependency on yoast/phpunit-polyfills 1.0.4
+
+* Sun Jun 30 2024 Remi Collet <remi@remirepo.net> - 6.9.1-4
+- add missing dependency on php-fedora-autoloader
+
+* Mon Nov 27 2023 Remi Collet <remi@remirepo.net> - 6.9.1-1
+- update to 6.9.1
+
+* Tue Aug 29 2023 Remi Collet <remi@remirepo.net> - 6.8.1-1
+- update to 6.8.1
+
+* Mon Mar 6 2023 Remi Collet <remi@remirepo.net> - 6.8.0-1
+- update to 6.8.0
+
+* Thu Dec 8 2022 Remi Collet <remi@remirepo.net> - 6.7.1-1
+- update to 6.7.1
+
+* Mon Dec 5 2022 Remi Collet <remi@remirepo.net> - 6.7-1
+- update to 6.7
+
+* Mon Oct 10 2022 Remi Collet <remi@remirepo.net> - 6.6.5-1
+- update to 6.6.5
+
+* Tue Aug 30 2022 Remi Collet <remi@remirepo.net> - 6.6.4-1
+- update to 6.6.4
+
+* Mon Jun 20 2022 Remi Collet <remi@remirepo.net> - 6.6.3-1
+- update to 6.6.3
+
+* Tue Jun 14 2022 Remi Collet <remi@remirepo.net> - 6.6.2-1
+- update to 6.6.2
+
+* Mon Feb 28 2022 Remi Collet <remi@remirepo.net> - 6.6.0-1
+- update to 6.6.0
+
+* Thu Feb 17 2022 Remi Collet <remi@remirepo.net> - 6.5.4-1
+- update to 6.5.4
+
+* Fri Nov 26 2021 Remi Collet <remi@remirepo.net> - 6.5.3-1
+- update to 6.5.3
+
+* Wed Sep 1 2021 Remi Collet <remi@remirepo.net> - 6.5.1-1
+- update to 6.5.1
+
+* Thu Jun 17 2021 Remi Collet <remi@remirepo.net> - 6.5.0-1
+- update to 6.5.0
+
+* Mon May 3 2021 Remi Collet <remi@remirepo.net> - 6.4.1-1
+- update to 6.4.1
+
+* Thu Apr 1 2021 Remi Collet <remi@remirepo.net> - 6.4.0-1
+- update to 6.4.0
+
+* Wed Feb 24 2021 Remi Collet <remi@remirepo.net> - 6.3.0-1
+- update to 6.3.0
+- php-imap is optional
+
+* Thu Nov 26 2020 Remi Collet <remi@remirepo.net> - 6.2.0-1
+- update to 6.2.0
+- add build dependency on yoast/phpunit-polyfills
+- switch to phpunit7
+
+* Sat Oct 10 2020 Remi Collet <remi@remirepo.net> - 6.1.8-1
+- update to 6.1.8
+
+* Wed Jul 15 2020 Remi Collet <remi@remirepo.net> - 6.1.7-1
+- update to 6.1.7
+
+* Wed May 27 2020 Remi Collet <remi@remirepo.net> - 6.1.6-1
+- update to 6.1.6
+
+* Sat Mar 14 2020 Remi Collet <remi@remirepo.net> - 6.1.5-1
+- update to 6.1.5
+
+* Tue Dec 10 2019 Remi Collet <remi@remirepo.net> - 6.1.4-1
+- update to 6.1.4
+
+* Thu Nov 21 2019 Remi Collet <remi@remirepo.net> - 6.1.3-1
+- update to 6.1.3
+
+* Thu Nov 14 2019 Remi Collet <remi@remirepo.net> - 6.1.2-1
+- update to 6.1.2
+
+* Mon Sep 30 2019 Remi Collet <remi@remirepo.net> - 6.1.1-1
+- update to 6.1.1
+
+* Mon Feb 4 2019 Remi Collet <remi@remirepo.net> - 6.0.7-1
+- update to 6.0.7
+
+* Fri Nov 16 2018 Remi Collet <remi@remirepo.net> - 6.0.6-1
+- update to 6.0.6
+
+* Wed Mar 28 2018 Remi Collet <remi@remirepo.net> - 6.0.5-1
+- update to 6.0.5 (no change)
+
+* Tue Mar 27 2018 Remi Collet <remi@remirepo.net> - 6.0.4-1
+- update to 6.0.4
+- add patch to fix lang_path with RPM layout
+
+* Sun Jan 7 2018 Remi Collet <remi@remirepo.net> - 6.0.3-1
+- Update to 6.0.3
+
+* Fri Dec 1 2017 Remi Collet <remi@remirepo.net> - 6.0.2-1
+- Update to 6.0.2
+
+* Wed Nov 15 2017 Remi Collet <remi@remirepo.net> - 6.0.1-1
+- initial rpm, version 6.0.1
+- open https://github.com/PHPMailer/PHPMailer/issues/1243 for FSF address