create-berna-stencil 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +8 -0
- package/.gitignore +2 -1
- package/README.md +1 -5
- package/bin/create.js +2 -1
- package/package.json +71 -70
- package/src/api/vendor/autoload.php +22 -22
- package/src/api/vendor/composer/ClassLoader.php +579 -579
- package/src/api/vendor/composer/InstalledVersions.php +396 -396
- package/src/api/vendor/composer/LICENSE +21 -21
- package/src/api/vendor/composer/autoload_classmap.php +15 -15
- package/src/api/vendor/composer/autoload_files.php +12 -12
- package/src/api/vendor/composer/autoload_namespaces.php +9 -9
- package/src/api/vendor/composer/autoload_psr4.php +16 -16
- package/src/api/vendor/composer/autoload_real.php +50 -50
- package/src/api/vendor/composer/autoload_static.php +86 -86
- package/src/api/vendor/composer/installed.json +582 -582
- package/src/api/vendor/composer/installed.php +86 -86
- package/src/api/vendor/composer/platform_check.php +25 -25
- package/src/api/vendor/graham-campbell/result-type/.gitattributes +9 -0
- package/src/api/vendor/graham-campbell/result-type/.github/CODE_OF_CONDUCT.md +132 -0
- package/src/api/vendor/graham-campbell/result-type/.github/CONTRIBUTING.md +31 -0
- package/src/api/vendor/graham-campbell/result-type/.github/FUNDING.yml +2 -0
- package/src/api/vendor/graham-campbell/result-type/.github/SECURITY.md +14 -0
- package/src/api/vendor/graham-campbell/result-type/.github/workflows/stale.yml +11 -0
- package/src/api/vendor/graham-campbell/result-type/.github/workflows/tests.yml +40 -0
- package/src/api/vendor/graham-campbell/result-type/CHANGELOG.md +53 -0
- package/src/api/vendor/graham-campbell/result-type/LICENSE +21 -0
- package/src/api/vendor/graham-campbell/result-type/README.md +42 -0
- package/src/api/vendor/graham-campbell/result-type/composer.json +33 -0
- package/src/api/vendor/graham-campbell/result-type/phpunit.xml.dist +13 -0
- package/src/api/vendor/graham-campbell/result-type/src/Error.php +121 -0
- package/src/api/vendor/graham-campbell/result-type/src/Result.php +69 -0
- package/src/api/vendor/graham-campbell/result-type/src/Success.php +120 -0
- package/src/api/vendor/graham-campbell/result-type/tests/ResultTest.php +95 -0
- package/src/api/vendor/phpmailer/phpmailer/.codecov.yml +21 -0
- package/src/api/vendor/phpmailer/phpmailer/.editorconfig +15 -0
- package/src/api/vendor/phpmailer/phpmailer/.gitattributes +17 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/FUNDING.yml +6 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/actions/build-docs/Dockerfile +15 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/actions/build-docs/entrypoint.sh +5 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/dependabot.yml +21 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/workflows/docs.yaml +30 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/workflows/scorecards.yml +61 -0
- package/src/api/vendor/phpmailer/phpmailer/.github/workflows/tests.yml +237 -0
- package/src/api/vendor/phpmailer/phpmailer/.phan/config.php +41 -0
- package/src/api/vendor/phpmailer/phpmailer/COMMITMENT +46 -0
- package/src/api/vendor/phpmailer/phpmailer/LICENSE +502 -0
- package/src/api/vendor/phpmailer/phpmailer/README.md +232 -0
- package/src/api/vendor/phpmailer/phpmailer/SECURITY.md +37 -0
- package/src/api/vendor/phpmailer/phpmailer/SMTPUTF8.md +48 -0
- package/src/api/vendor/phpmailer/phpmailer/UPGRADING.md +125 -0
- package/src/api/vendor/phpmailer/phpmailer/VERSION +1 -0
- package/src/api/vendor/phpmailer/phpmailer/changelog.md +1122 -0
- package/src/api/vendor/phpmailer/phpmailer/composer.json +84 -0
- package/src/api/vendor/phpmailer/phpmailer/docs/README.md +9 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/DKIM_gen_keys.phps +81 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/DKIM_sign.phps +46 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/README.md +96 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/azure_xoauth2.phps +126 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/callback.phps +76 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/contactform-ajax.phps +146 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/contactform.phps +95 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/contents.html +17 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/contentsutf8.html +23 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/exceptions.phps +40 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/extending.phps +72 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/gmail.phps +106 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/gmail_xoauth.phps +121 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.afdesign +0 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.png +0 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.svg +209 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/images/phpmailer.png +0 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/images/phpmailer_mini.png +0 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/mail.phps +35 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/mailing_list.phps +96 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/pop_before_smtp.phps +60 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/send_file_upload.phps +60 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/send_multiple_file_upload.phps +60 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/sendmail.phps +37 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/sendoauth2.phps +100 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/simple_contact_form.phps +102 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/smime_signed_mail.phps +99 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/smtp.phps +62 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/smtp_check.phps +60 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/smtp_low_memory.phps +117 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/smtp_no_auth.phps +53 -0
- package/src/api/vendor/phpmailer/phpmailer/examples/ssl_options.phps +81 -0
- package/src/api/vendor/phpmailer/phpmailer/get_oauth_token.php +182 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php +26 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php +35 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-az.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ba.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-be.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-bg.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php +35 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-cs.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php +39 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php +33 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-eo.php +37 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +38 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-fa.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +36 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-gl.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-he.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php +35 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-hr.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-hy.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-id.php +31 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +37 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ka.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ko.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-lt.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-lv.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-mg.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ms.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php +37 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php +38 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php +33 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php +34 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +38 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +33 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +36 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php +34 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php +30 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php +36 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr_latn.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-tl.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +38 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-uk.php +28 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php +30 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-vi.php +27 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php +29 -0
- package/src/api/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +36 -0
- package/src/api/vendor/phpmailer/phpmailer/phpcs.xml.dist +52 -0
- package/src/api/vendor/phpmailer/phpmailer/phpdoc.dist.xml +20 -0
- package/src/api/vendor/phpmailer/phpmailer/phpunit.xml.dist +36 -0
- package/src/api/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +245 -0
- package/src/api/vendor/phpmailer/phpmailer/src/Exception.php +40 -0
- package/src/api/vendor/phpmailer/phpmailer/src/OAuth.php +139 -0
- package/src/api/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php +44 -0
- package/src/api/vendor/phpmailer/phpmailer/src/PHPMailer.php +5525 -0
- package/src/api/vendor/phpmailer/phpmailer/src/POP3.php +470 -0
- package/src/api/vendor/phpmailer/phpmailer/src/SMTP.php +1617 -0
- package/src/api/vendor/phpmailer/phpmailer/test/DebugLogTestListener.php +47 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/accessible.txt +1 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/inaccessible.txt +1 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-fr.php +10 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-nl.php +10 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xa_scri_cc.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xb_scri.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xc_cc.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_cc.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_scri.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xe.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xx.php +9 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yy.php +16 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yz.php +16 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-zz.php +20 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Language/TranslationCompletenessTest.php +97 -0
- package/src/api/vendor/phpmailer/phpmailer/test/OAuth/OAuthTest.php +76 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/AddEmbeddedImageTest.php +178 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringAttachmentTest.php +147 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringEmbeddedImageTest.php +161 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/AddrFormatTest.php +70 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/AuthCRAMMD5Test.php +48 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/CustomHeaderTest.php +285 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMTest.php +258 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMWithoutExceptionsTest.php +46 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/DSNConfiguratorTest.php +221 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeQTest.php +110 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeStringTest.php +135 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/FileIsAccessibleTest.php +103 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/FilenameToTypeTest.php +74 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/GenerateIdTest.php +75 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/GetLastMessageIDTest.php +110 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/HasLineLongerThanMaxTest.php +158 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/Html2TextTest.php +231 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/ICalTest.php +126 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/IsPermittedPathTest.php +108 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/IsValidHostTest.php +107 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/LocalizationTest.php +505 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/MailTransportTest.php +261 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/MbPathinfoTest.php +171 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/MimeTypesTest.php +70 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/NormalizeBreaksTest.php +111 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/PHPMailerTest.php +1388 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/ParseAddressesTest.php +321 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/PunyencodeAddressTest.php +141 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/QuotedStringTest.php +70 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/ReplyToGetSetClearTest.php +444 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/SetErrorTest.php +154 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/SetFromTest.php +202 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/SetTest.php +81 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/SetWordWrapTest.php +120 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/Utf8CharBoundaryTest.php +66 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressCustomValidatorTest.php +116 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressTest.php +485 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/WrapTextTest.php +125 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PHPMailer/XMailerTest.php +75 -0
- package/src/api/vendor/phpmailer/phpmailer/test/POP3/PopBeforeSmtpTest.php +139 -0
- package/src/api/vendor/phpmailer/phpmailer/test/PreSendTestCase.php +46 -0
- package/src/api/vendor/phpmailer/phpmailer/test/Security/DenialOfServiceVectorsTest.php +52 -0
- package/src/api/vendor/phpmailer/phpmailer/test/SendTestCase.php +126 -0
- package/src/api/vendor/phpmailer/phpmailer/test/TestCase.php +392 -0
- package/src/api/vendor/phpmailer/phpmailer/test/fakepopserver.sh +126 -0
- package/src/api/vendor/phpmailer/phpmailer/test/fakesendmail.sh +22 -0
- package/src/api/vendor/phpmailer/phpmailer/test/runfakepopserver.sh +12 -0
- package/src/api/vendor/phpmailer/phpmailer/test/testbootstrap-dist.php +8 -0
- package/src/api/vendor/phpmailer/phpmailer/test/validators.php +12 -0
- package/src/api/vendor/phpoption/phpoption/.gitattributes +13 -0
- package/src/api/vendor/phpoption/phpoption/.github/CODE_OF_CONDUCT.md +132 -0
- package/src/api/vendor/phpoption/phpoption/.github/CONTRIBUTING.md +30 -0
- package/src/api/vendor/phpoption/phpoption/.github/FUNDING.yml +2 -0
- package/src/api/vendor/phpoption/phpoption/.github/SECURITY.md +14 -0
- package/src/api/vendor/phpoption/phpoption/.github/workflows/static.yml +40 -0
- package/src/api/vendor/phpoption/phpoption/.github/workflows/tests.yml +40 -0
- package/src/api/vendor/phpoption/phpoption/LICENSE +201 -0
- package/src/api/vendor/phpoption/phpoption/Makefile +17 -0
- package/src/api/vendor/phpoption/phpoption/README.md +201 -0
- package/src/api/vendor/phpoption/phpoption/composer.json +50 -0
- package/src/api/vendor/phpoption/phpoption/phpstan-baseline.neon +44 -0
- package/src/api/vendor/phpoption/phpoption/phpstan.neon.dist +7 -0
- package/src/api/vendor/phpoption/phpoption/phpunit.xml.dist +13 -0
- package/src/api/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php +175 -0
- package/src/api/vendor/phpoption/phpoption/src/PhpOption/None.php +136 -0
- package/src/api/vendor/phpoption/phpoption/src/PhpOption/Option.php +434 -0
- package/src/api/vendor/phpoption/phpoption/src/PhpOption/Some.php +169 -0
- package/src/api/vendor/phpoption/phpoption/tests/PhpOption/Tests/EnsureTest.php +72 -0
- package/src/api/vendor/phpoption/phpoption/tests/PhpOption/Tests/LazyOptionTest.php +357 -0
- package/src/api/vendor/phpoption/phpoption/tests/PhpOption/Tests/NoneTest.php +153 -0
- package/src/api/vendor/phpoption/phpoption/tests/PhpOption/Tests/OptionTest.php +166 -0
- package/src/api/vendor/phpoption/phpoption/tests/PhpOption/Tests/SomeTest.php +194 -0
- package/src/api/vendor/phpoption/phpoption/tests/bootstrap.php +8 -0
- package/src/api/vendor/phpoption/phpoption/vendor-bin/phpstan/composer.json +8 -0
- package/src/api/vendor/symfony/polyfill-ctype/Ctype.php +232 -0
- package/src/api/vendor/symfony/polyfill-ctype/LICENSE +19 -0
- package/src/api/vendor/symfony/polyfill-ctype/README.md +12 -0
- package/src/api/vendor/symfony/polyfill-ctype/bootstrap.php +50 -0
- package/src/api/vendor/symfony/polyfill-ctype/bootstrap80.php +46 -0
- package/src/api/vendor/symfony/polyfill-ctype/composer.json +38 -0
- package/src/api/vendor/symfony/polyfill-mbstring/LICENSE +19 -0
- package/src/api/vendor/symfony/polyfill-mbstring/Mbstring.php +1077 -0
- package/src/api/vendor/symfony/polyfill-mbstring/README.md +13 -0
- package/src/api/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -0
- package/src/api/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1397 -0
- package/src/api/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +5 -0
- package/src/api/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +1489 -0
- package/src/api/vendor/symfony/polyfill-mbstring/bootstrap.php +171 -0
- package/src/api/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -0
- package/src/api/vendor/symfony/polyfill-mbstring/composer.json +39 -0
- package/src/api/vendor/symfony/polyfill-php80/LICENSE +19 -0
- package/src/api/vendor/symfony/polyfill-php80/Php80.php +115 -0
- package/src/api/vendor/symfony/polyfill-php80/PhpToken.php +106 -0
- package/src/api/vendor/symfony/polyfill-php80/README.md +25 -0
- package/src/api/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +31 -0
- package/src/api/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +16 -0
- package/src/api/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +20 -0
- package/src/api/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +16 -0
- package/src/api/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +16 -0
- package/src/api/vendor/symfony/polyfill-php80/bootstrap.php +42 -0
- package/src/api/vendor/symfony/polyfill-php80/composer.json +37 -0
- package/src/api/vendor/vlucas/phpdotenv/.editorconfig +15 -0
- package/src/api/vendor/vlucas/phpdotenv/.gitattributes +15 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/CODE_OF_CONDUCT.md +132 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/CONTRIBUTING.md +30 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/FUNDING.yml +2 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/SECURITY.md +14 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/workflows/static.yml +40 -0
- package/src/api/vendor/vlucas/phpdotenv/.github/workflows/tests.yml +70 -0
- package/src/api/vendor/vlucas/phpdotenv/LICENSE +30 -0
- package/src/api/vendor/vlucas/phpdotenv/Makefile +17 -0
- package/src/api/vendor/vlucas/phpdotenv/README.md +370 -0
- package/src/api/vendor/vlucas/phpdotenv/UPGRADING.md +196 -0
- package/src/api/vendor/vlucas/phpdotenv/composer.json +60 -0
- package/src/api/vendor/vlucas/phpdotenv/phpstan-baseline.neon +157 -0
- package/src/api/vendor/vlucas/phpdotenv/phpstan.neon.dist +7 -0
- package/src/api/vendor/vlucas/phpdotenv/phpunit.xml.dist +13 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Dotenv.php +267 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php +12 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php +12 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php +12 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php +12 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php +12 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Loader/Loader.php +48 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php +20 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Loader/Resolver.php +65 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/Entry.php +59 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php +299 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/Lexer.php +58 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/Lines.php +127 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/Parser.php +53 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php +19 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Parser/Value.php +88 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php +15 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php +89 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php +80 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php +88 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php +85 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php +110 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php +48 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php +64 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php +91 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php +17 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReplacingWriter.php +104 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php +88 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php +27 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php +107 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/RepositoryBuilder.php +272 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Repository/RepositoryInterface.php +51 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/File/Paths.php +44 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/File/Reader.php +81 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/FileStore.php +72 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/StoreBuilder.php +141 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/StoreInterface.php +17 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Store/StringStore.php +37 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Util/Regex.php +112 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Util/Str.php +108 -0
- package/src/api/vendor/vlucas/phpdotenv/src/Validator.php +207 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/DotenvTest.php +387 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Loader/LoaderTest.php +86 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/EntryParserTest.php +234 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LexerTest.php +40 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LinesTest.php +53 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/ParserTest.php +98 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ArrayAdapterTest.php +57 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/EnvConstAdapterTest.php +75 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/PutenvAdapterTest.php +52 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ServerConstAdapterTest.php +75 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/RepositoryTest.php +305 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/Store/StoreTest.php +141 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/Dotenv/ValidatorTest.php +479 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/.env +5 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/assertions.env +18 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/booleans.env +33 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/commented.env +15 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/empty.env +1 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/example.env +1 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/exported.env +7 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/immutable.env +1 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/integers.env +17 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/large.env +2 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/multibyte.env +3 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/multiline.env +14 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/multiple.env +4 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/mutable.env +1 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/nested.env +15 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/quoted.env +11 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/specialchars.env +8 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/unicodevarnames.env +2 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/utf8-with-bom-encoding.env +3 -0
- package/src/api/vendor/vlucas/phpdotenv/tests/fixtures/env/windows.env +1 -0
- package/src/api/vendor/vlucas/phpdotenv/vendor-bin/phpstan/composer.json +15 -0
|
@@ -0,0 +1,1388 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PHPMailer - PHP email transport unit tests.
|
|
5
|
+
* PHP version 5.5.
|
|
6
|
+
*
|
|
7
|
+
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
|
8
|
+
* @author Andy Prevost
|
|
9
|
+
* @copyright 2012 - 2020 Marcus Bointon
|
|
10
|
+
* @copyright 2004 - 2009 Andy Prevost
|
|
11
|
+
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
namespace PHPMailer\Test\PHPMailer;
|
|
15
|
+
|
|
16
|
+
use PHPMailer\PHPMailer\Exception;
|
|
17
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
18
|
+
use PHPMailer\PHPMailer\SMTP;
|
|
19
|
+
use PHPMailer\Test\SendTestCase;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* PHPMailer - PHP email transport unit test class.
|
|
23
|
+
*/
|
|
24
|
+
final class PHPMailerTest extends SendTestCase
|
|
25
|
+
{
|
|
26
|
+
private $Smtp;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Test low priority.
|
|
30
|
+
*/
|
|
31
|
+
public function testLowPriority()
|
|
32
|
+
{
|
|
33
|
+
$this->Mail->Priority = 5;
|
|
34
|
+
$this->Mail->Body = 'Here is the main body. There should be ' .
|
|
35
|
+
'a reply to address in this message.';
|
|
36
|
+
$this->Mail->Subject .= ': Low Priority';
|
|
37
|
+
|
|
38
|
+
$this->buildBody();
|
|
39
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Simple plain file attachment test.
|
|
44
|
+
*/
|
|
45
|
+
public function testMultiplePlainFileAttachment()
|
|
46
|
+
{
|
|
47
|
+
$this->Mail->Body = 'Here is the text body';
|
|
48
|
+
$this->Mail->Subject .= ': Plain + Multiple FileAttachments';
|
|
49
|
+
|
|
50
|
+
if (!$this->Mail->addAttachment(realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer.png'))) {
|
|
51
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
|
|
57
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
58
|
+
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$this->buildBody();
|
|
63
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Rejection of non-local file attachments test.
|
|
68
|
+
*/
|
|
69
|
+
public function testRejectNonLocalFileAttachment()
|
|
70
|
+
{
|
|
71
|
+
self::assertFalse(
|
|
72
|
+
$this->Mail->addAttachment('https://github.com/PHPMailer/PHPMailer/raw/master/README.md'),
|
|
73
|
+
'addAttachment should reject remote URLs'
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
self::assertFalse(
|
|
77
|
+
$this->Mail->addAttachment('phar://phar.php'),
|
|
78
|
+
'addAttachment should reject phar resources'
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Plain quoted-printable message.
|
|
84
|
+
*/
|
|
85
|
+
public function testQuotedPrintable()
|
|
86
|
+
{
|
|
87
|
+
$this->Mail->Body = 'Here is the main body';
|
|
88
|
+
$this->Mail->Subject .= ': Plain + Quoted-printable';
|
|
89
|
+
$this->Mail->Encoding = 'quoted-printable';
|
|
90
|
+
|
|
91
|
+
$this->buildBody();
|
|
92
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
93
|
+
|
|
94
|
+
//Check that a quoted printable encode and decode results in the same as went in
|
|
95
|
+
$t = file_get_contents(__FILE__); //Use this file as test content
|
|
96
|
+
//Force line breaks to UNIX-style
|
|
97
|
+
$t = str_replace(["\r\n", "\r"], "\n", $t);
|
|
98
|
+
self::assertSame(
|
|
99
|
+
$t,
|
|
100
|
+
quoted_printable_decode($this->Mail->encodeQP($t)),
|
|
101
|
+
'Quoted-Printable encoding round-trip failed'
|
|
102
|
+
);
|
|
103
|
+
//Force line breaks to Windows-style
|
|
104
|
+
$t = str_replace("\n", "\r\n", $t);
|
|
105
|
+
self::assertSame(
|
|
106
|
+
$t,
|
|
107
|
+
quoted_printable_decode($this->Mail->encodeQP($t)),
|
|
108
|
+
'Quoted-Printable encoding round-trip failed (Windows line breaks)'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Test header encoding & folding.
|
|
114
|
+
*/
|
|
115
|
+
public function testHeaderEncoding()
|
|
116
|
+
{
|
|
117
|
+
$this->Mail->CharSet = PHPMailer::CHARSET_UTF8;
|
|
118
|
+
$letter = html_entity_decode('é', ENT_COMPAT, PHPMailer::CHARSET_UTF8);
|
|
119
|
+
//This should select B-encoding automatically and should fold
|
|
120
|
+
$bencode = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 1);
|
|
121
|
+
//This should select Q-encoding automatically and should fold
|
|
122
|
+
$qencode = str_repeat('e', PHPMailer::STD_LINE_LENGTH) . $letter;
|
|
123
|
+
//This should select B-encoding automatically and should not fold
|
|
124
|
+
$bencodenofold = str_repeat($letter, 10);
|
|
125
|
+
//This should select Q-encoding automatically and should not fold
|
|
126
|
+
$qencodenofold = str_repeat('e', 9) . $letter;
|
|
127
|
+
//This should Q-encode as ASCII and fold (previously, this did not encode)
|
|
128
|
+
$longheader = str_repeat('e', PHPMailer::STD_LINE_LENGTH + 10);
|
|
129
|
+
//This should Q-encode as UTF-8 and fold
|
|
130
|
+
$longutf8 = str_repeat($letter, PHPMailer::STD_LINE_LENGTH + 10);
|
|
131
|
+
//This should not change
|
|
132
|
+
$noencode = 'eeeeeeeeee';
|
|
133
|
+
$this->Mail->isMail();
|
|
134
|
+
//Expected results
|
|
135
|
+
|
|
136
|
+
$bencoderes = '=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
137
|
+
PHPMailer::getLE() .
|
|
138
|
+
' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
139
|
+
PHPMailer::getLE() .
|
|
140
|
+
' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
141
|
+
PHPMailer::getLE() .
|
|
142
|
+
' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqQ==?=';
|
|
143
|
+
$qencoderes = '=?utf-8?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?=' .
|
|
144
|
+
PHPMailer::getLE() .
|
|
145
|
+
' =?utf-8?Q?eeeeeeeeeeeeeeeeeeeeeeeeee=C3=A9?=';
|
|
146
|
+
$bencodenofoldres = '=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6k=?=';
|
|
147
|
+
$qencodenofoldres = '=?utf-8?Q?eeeeeeeee=C3=A9?=';
|
|
148
|
+
$longheaderres = '=?us-ascii?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?=' .
|
|
149
|
+
PHPMailer::getLE() . ' =?us-ascii?Q?eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee?=';
|
|
150
|
+
$longutf8res = '=?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
151
|
+
PHPMailer::getLE() . ' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
152
|
+
PHPMailer::getLE() . ' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6k=?=' .
|
|
153
|
+
PHPMailer::getLE() . ' =?utf-8?B?w6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqQ==?=';
|
|
154
|
+
$noencoderes = 'eeeeeeeeee';
|
|
155
|
+
self::assertSame(
|
|
156
|
+
$bencoderes,
|
|
157
|
+
$this->Mail->encodeHeader($bencode),
|
|
158
|
+
'Folded B-encoded header value incorrect'
|
|
159
|
+
);
|
|
160
|
+
self::assertSame(
|
|
161
|
+
$qencoderes,
|
|
162
|
+
$this->Mail->encodeHeader($qencode),
|
|
163
|
+
'Folded Q-encoded header value incorrect'
|
|
164
|
+
);
|
|
165
|
+
self::assertSame(
|
|
166
|
+
$bencodenofoldres,
|
|
167
|
+
$this->Mail->encodeHeader($bencodenofold),
|
|
168
|
+
'B-encoded header value incorrect'
|
|
169
|
+
);
|
|
170
|
+
self::assertSame(
|
|
171
|
+
$qencodenofoldres,
|
|
172
|
+
$this->Mail->encodeHeader($qencodenofold),
|
|
173
|
+
'Q-encoded header value incorrect'
|
|
174
|
+
);
|
|
175
|
+
self::assertSame(
|
|
176
|
+
$longheaderres,
|
|
177
|
+
$this->Mail->encodeHeader($longheader),
|
|
178
|
+
'Long header value incorrect'
|
|
179
|
+
);
|
|
180
|
+
self::assertSame(
|
|
181
|
+
$longutf8res,
|
|
182
|
+
$this->Mail->encodeHeader($longutf8),
|
|
183
|
+
'Long UTF-8 header value incorrect'
|
|
184
|
+
);
|
|
185
|
+
self::assertSame(
|
|
186
|
+
$noencoderes,
|
|
187
|
+
$this->Mail->encodeHeader($noencode),
|
|
188
|
+
'Unencoded header value incorrect'
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Send an HTML message.
|
|
194
|
+
*/
|
|
195
|
+
public function testHtml()
|
|
196
|
+
{
|
|
197
|
+
$this->Mail->isHTML(true);
|
|
198
|
+
$this->Mail->Subject .= ': HTML only';
|
|
199
|
+
|
|
200
|
+
$this->Mail->Body = <<<'EOT'
|
|
201
|
+
<!DOCTYPE html>
|
|
202
|
+
<html lang="en">
|
|
203
|
+
<head>
|
|
204
|
+
<title>HTML email test</title>
|
|
205
|
+
</head>
|
|
206
|
+
<body>
|
|
207
|
+
<h1>PHPMailer does HTML!</h1>
|
|
208
|
+
<p>This is a <strong>test message</strong> written in HTML.<br>
|
|
209
|
+
Go to <a href="https://github.com/PHPMailer/PHPMailer/">https://github.com/PHPMailer/PHPMailer/</a>
|
|
210
|
+
for new versions of PHPMailer.</p>
|
|
211
|
+
<p>Thank you!</p>
|
|
212
|
+
</body>
|
|
213
|
+
</html>
|
|
214
|
+
EOT;
|
|
215
|
+
$this->buildBody();
|
|
216
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
217
|
+
$msg = $this->Mail->getSentMIMEMessage();
|
|
218
|
+
self::assertStringNotContainsString("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Send an HTML message specifying the DSN notifications we expect.
|
|
223
|
+
*/
|
|
224
|
+
public function testDsn()
|
|
225
|
+
{
|
|
226
|
+
$this->Mail->isHTML(true);
|
|
227
|
+
$this->Mail->Subject .= ': HTML only';
|
|
228
|
+
|
|
229
|
+
$this->Mail->Body = <<<'EOT'
|
|
230
|
+
<!DOCTYPE html>
|
|
231
|
+
<html lang="en">
|
|
232
|
+
<head>
|
|
233
|
+
<title>HTML email test</title>
|
|
234
|
+
</head>
|
|
235
|
+
<body>
|
|
236
|
+
<p>PHPMailer</p>
|
|
237
|
+
</body>
|
|
238
|
+
</html>
|
|
239
|
+
EOT;
|
|
240
|
+
$this->buildBody();
|
|
241
|
+
$this->Mail->dsn = 'SUCCESS,FAILURE';
|
|
242
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
243
|
+
//Sends the same mail, but sets the DSN notification to NEVER
|
|
244
|
+
$this->Mail->dsn = 'NEVER';
|
|
245
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* createBody test of switch case
|
|
250
|
+
*/
|
|
251
|
+
public function testCreateBody()
|
|
252
|
+
{
|
|
253
|
+
$PHPMailer = new PHPMailer();
|
|
254
|
+
$reflection = new \ReflectionClass($PHPMailer);
|
|
255
|
+
$property = $reflection->getProperty('message_type');
|
|
256
|
+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
|
|
257
|
+
$property->setValue($PHPMailer, 'inline');
|
|
258
|
+
self::assertIsString($PHPMailer->createBody());
|
|
259
|
+
|
|
260
|
+
$property->setValue($PHPMailer, 'attach');
|
|
261
|
+
self::assertIsString($PHPMailer->createBody());
|
|
262
|
+
|
|
263
|
+
$property->setValue($PHPMailer, 'inline_attach');
|
|
264
|
+
self::assertIsString($PHPMailer->createBody());
|
|
265
|
+
|
|
266
|
+
$property->setValue($PHPMailer, 'alt');
|
|
267
|
+
self::assertIsString($PHPMailer->createBody());
|
|
268
|
+
|
|
269
|
+
$property->setValue($PHPMailer, 'alt_inline');
|
|
270
|
+
self::assertIsString($PHPMailer->createBody());
|
|
271
|
+
|
|
272
|
+
$property->setValue($PHPMailer, 'alt_attach');
|
|
273
|
+
self::assertIsString($PHPMailer->createBody());
|
|
274
|
+
|
|
275
|
+
$property->setValue($PHPMailer, 'alt_inline_attach');
|
|
276
|
+
self::assertIsString($PHPMailer->createBody());
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Send a message containing ISO-8859-1 text.
|
|
281
|
+
*
|
|
282
|
+
* @requires extension mbstring
|
|
283
|
+
*/
|
|
284
|
+
public function testHtmlIso8859()
|
|
285
|
+
{
|
|
286
|
+
$this->Mail->isHTML(true);
|
|
287
|
+
$this->Mail->Subject .= ': ISO-8859-1 HTML';
|
|
288
|
+
$this->Mail->CharSet = PHPMailer::CHARSET_ISO88591;
|
|
289
|
+
|
|
290
|
+
//This file is in ISO-8859-1 charset
|
|
291
|
+
//Needs to be external because this file is in UTF-8
|
|
292
|
+
$content = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . '/examples/contents.html'));
|
|
293
|
+
//This is the string 'éèîüçÅñæß' in ISO-8859-1, base-64 encoded
|
|
294
|
+
$check = base64_decode('6eju/OfF8ebf');
|
|
295
|
+
//Make sure it really is in ISO-8859-1!
|
|
296
|
+
$this->Mail->msgHTML(
|
|
297
|
+
mb_convert_encoding(
|
|
298
|
+
$content,
|
|
299
|
+
'ISO-8859-1',
|
|
300
|
+
mb_detect_encoding($content, 'UTF-8, ISO-8859-1, ISO-8859-15', true)
|
|
301
|
+
),
|
|
302
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples')
|
|
303
|
+
);
|
|
304
|
+
$this->buildBody();
|
|
305
|
+
self::assertStringContainsString($check, $this->Mail->Body, 'ISO message body does not contain expected text');
|
|
306
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Send a message containing multilingual UTF-8 text.
|
|
311
|
+
*/
|
|
312
|
+
public function testHtmlUtf8()
|
|
313
|
+
{
|
|
314
|
+
$this->Mail->isHTML(true);
|
|
315
|
+
$this->Mail->Subject .= ': UTF-8 HTML Пустое тело сообщения';
|
|
316
|
+
$this->Mail->CharSet = 'UTF-8';
|
|
317
|
+
|
|
318
|
+
$this->Mail->Body = <<<'EOT'
|
|
319
|
+
<!DOCTYPE html>
|
|
320
|
+
<html lang="en">
|
|
321
|
+
<head>
|
|
322
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
323
|
+
<title>HTML email test</title>
|
|
324
|
+
</head>
|
|
325
|
+
<body>
|
|
326
|
+
<p>Chinese text: 郵件內容為空</p>
|
|
327
|
+
<p>Russian text: Пустое тело сообщения</p>
|
|
328
|
+
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
|
|
329
|
+
<p>Czech text: Prázdné tělo zprávy</p>
|
|
330
|
+
</body>
|
|
331
|
+
</html>
|
|
332
|
+
EOT;
|
|
333
|
+
$this->buildBody();
|
|
334
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
335
|
+
$msg = $this->Mail->getSentMIMEMessage();
|
|
336
|
+
self::assertStringNotContainsString("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Send a message containing multilingual UTF-8 text with an embedded image.
|
|
341
|
+
*/
|
|
342
|
+
public function testUtf8WithEmbeddedImage()
|
|
343
|
+
{
|
|
344
|
+
$this->Mail->isHTML(true);
|
|
345
|
+
$this->Mail->Subject .= ': UTF-8 with embedded image';
|
|
346
|
+
$this->Mail->CharSet = 'UTF-8';
|
|
347
|
+
|
|
348
|
+
$this->Mail->Body = <<<'EOT'
|
|
349
|
+
<!DOCTYPE html>
|
|
350
|
+
<html lang="en">
|
|
351
|
+
<head>
|
|
352
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
353
|
+
<title>HTML email test</title>
|
|
354
|
+
</head>
|
|
355
|
+
<body>
|
|
356
|
+
<p>Chinese text: 郵件內容為空</p>
|
|
357
|
+
<p>Russian text: Пустое тело сообщения</p>
|
|
358
|
+
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
|
|
359
|
+
<p>Czech text: Prázdné tělo zprávy</p>
|
|
360
|
+
Embedded Image: <img alt="phpmailer" src="cid:bäck">
|
|
361
|
+
</body>
|
|
362
|
+
</html>
|
|
363
|
+
EOT;
|
|
364
|
+
$this->Mail->addEmbeddedImage(
|
|
365
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer.png'),
|
|
366
|
+
'bäck',
|
|
367
|
+
'phpmailer.png',
|
|
368
|
+
'base64',
|
|
369
|
+
'image/png'
|
|
370
|
+
);
|
|
371
|
+
$this->buildBody();
|
|
372
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Send a message containing multilingual UTF-8 text.
|
|
377
|
+
*/
|
|
378
|
+
public function testPlainUtf8()
|
|
379
|
+
{
|
|
380
|
+
$this->Mail->isHTML(false);
|
|
381
|
+
$this->Mail->Subject .= ': UTF-8 plain text';
|
|
382
|
+
$this->Mail->CharSet = 'UTF-8';
|
|
383
|
+
|
|
384
|
+
$this->Mail->Body = <<<'EOT'
|
|
385
|
+
Chinese text: 郵件內容為空
|
|
386
|
+
Russian text: Пустое тело сообщения
|
|
387
|
+
Armenian text: Հաղորդագրությունը դատարկ է
|
|
388
|
+
Czech text: Prázdné tělo zprávy
|
|
389
|
+
EOT;
|
|
390
|
+
$this->buildBody();
|
|
391
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
392
|
+
$msg = $this->Mail->getSentMIMEMessage();
|
|
393
|
+
self::assertStringNotContainsString("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Test simple message builder and html2text converters.
|
|
398
|
+
*/
|
|
399
|
+
public function testMsgHTML()
|
|
400
|
+
{
|
|
401
|
+
$message = file_get_contents(realpath(\PHPMAILER_INCLUDE_DIR . '/examples/contentsutf8.html'));
|
|
402
|
+
$this->Mail->CharSet = PHPMailer::CHARSET_UTF8;
|
|
403
|
+
$this->Mail->Body = '';
|
|
404
|
+
$this->Mail->AltBody = '';
|
|
405
|
+
//Uses internal HTML to text conversion
|
|
406
|
+
$this->Mail->msgHTML($message, realpath(\PHPMAILER_INCLUDE_DIR . '/examples'));
|
|
407
|
+
$sub = $this->Mail->Subject . ': msgHTML';
|
|
408
|
+
$this->Mail->Subject .= $sub;
|
|
409
|
+
|
|
410
|
+
self::assertNotEmpty($this->Mail->Body, 'Body not set by msgHTML');
|
|
411
|
+
self::assertNotEmpty($this->Mail->AltBody, 'AltBody not set by msgHTML');
|
|
412
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
413
|
+
|
|
414
|
+
//Again, using a custom HTML to text converter
|
|
415
|
+
$this->Mail->AltBody = '';
|
|
416
|
+
$this->Mail->msgHTML(
|
|
417
|
+
$message,
|
|
418
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples'),
|
|
419
|
+
static function ($html) {
|
|
420
|
+
return strtoupper(strip_tags($html));
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
$this->Mail->Subject = $sub . ' + custom html2text';
|
|
424
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
425
|
+
|
|
426
|
+
//Test that local paths without a basedir are ignored
|
|
427
|
+
$this->Mail->msgHTML('<img src="/etc/hostname">test');
|
|
428
|
+
self::assertStringContainsString('src="/etc/hostname"', $this->Mail->Body);
|
|
429
|
+
//Test that local paths with a basedir are not ignored
|
|
430
|
+
$this->Mail->msgHTML('<img src="composer.json">test', realpath(\PHPMAILER_INCLUDE_DIR));
|
|
431
|
+
self::assertStringNotContainsString('src="composer.json"', $this->Mail->Body);
|
|
432
|
+
//Test that local paths with parent traversal are ignored
|
|
433
|
+
$this->Mail->msgHTML('<img src="../composer.json">test', realpath(\PHPMAILER_INCLUDE_DIR));
|
|
434
|
+
self::assertStringNotContainsString('src="composer.json"', $this->Mail->Body);
|
|
435
|
+
//Test that existing embedded URLs are ignored
|
|
436
|
+
$this->Mail->msgHTML('<img src="cid:5d41402abc4b2a76b9719d911017c592">test');
|
|
437
|
+
self::assertStringContainsString('src="cid:5d41402abc4b2a76b9719d911017c592"', $this->Mail->Body);
|
|
438
|
+
//Test that absolute URLs are ignored
|
|
439
|
+
$this->Mail->msgHTML('<img src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json">test');
|
|
440
|
+
self::assertStringContainsString(
|
|
441
|
+
'src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json"',
|
|
442
|
+
$this->Mail->Body
|
|
443
|
+
);
|
|
444
|
+
//Test that absolute URLs with anonymous/relative protocol are ignored
|
|
445
|
+
//Note that such URLs will not work in email anyway because they have no protocol to be relative to
|
|
446
|
+
$this->Mail->msgHTML('<img src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json">test');
|
|
447
|
+
self::assertStringContainsString(
|
|
448
|
+
'src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json"',
|
|
449
|
+
$this->Mail->Body
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Simple HTML and attachment test.
|
|
455
|
+
*/
|
|
456
|
+
public function testHTMLAttachment()
|
|
457
|
+
{
|
|
458
|
+
$this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
|
|
459
|
+
$this->Mail->Subject .= ': HTML + Attachment';
|
|
460
|
+
$this->Mail->isHTML(true);
|
|
461
|
+
$this->Mail->CharSet = 'UTF-8';
|
|
462
|
+
|
|
463
|
+
if (
|
|
464
|
+
!$this->Mail->addAttachment(
|
|
465
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer_mini.png'),
|
|
466
|
+
'phpmailer_mini.png'
|
|
467
|
+
)
|
|
468
|
+
) {
|
|
469
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
470
|
+
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
//Make sure phar paths are rejected
|
|
475
|
+
self::assertFalse($this->Mail->addAttachment('phar://pharfile.php', 'pharfile.php'));
|
|
476
|
+
//Make sure any path that looks URLish is rejected
|
|
477
|
+
self::assertFalse($this->Mail->addAttachment('https://example.com/test.php', 'test.php'));
|
|
478
|
+
self::assertFalse(
|
|
479
|
+
$this->Mail->addAttachment(
|
|
480
|
+
'ssh2.sftp://user:pass@attacker-controlled.example.com:22/tmp/payload.phar',
|
|
481
|
+
'test.php'
|
|
482
|
+
)
|
|
483
|
+
);
|
|
484
|
+
self::assertFalse($this->Mail->addAttachment('x-1.cd+-://example.com/test.php', 'test.php'));
|
|
485
|
+
|
|
486
|
+
//Make sure that trying to attach a nonexistent file fails
|
|
487
|
+
$filename = __FILE__ . md5(microtime()) . 'nonexistent_file.txt';
|
|
488
|
+
self::assertFalse($this->Mail->addAttachment($filename));
|
|
489
|
+
//Make sure that trying to attach an existing but unreadable file fails
|
|
490
|
+
touch($filename);
|
|
491
|
+
chmod($filename, 0200);
|
|
492
|
+
self::assertFalse($this->Mail->addAttachment($filename));
|
|
493
|
+
chmod($filename, 0644);
|
|
494
|
+
unlink($filename);
|
|
495
|
+
|
|
496
|
+
$this->buildBody();
|
|
497
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Attachment naming test.
|
|
502
|
+
*/
|
|
503
|
+
public function testAttachmentNaming()
|
|
504
|
+
{
|
|
505
|
+
$this->Mail->Body = 'Attachments.';
|
|
506
|
+
$this->Mail->Subject .= ': Attachments';
|
|
507
|
+
$this->Mail->isHTML(true);
|
|
508
|
+
$this->Mail->CharSet = 'UTF-8';
|
|
509
|
+
$this->Mail->addAttachment(
|
|
510
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer_mini.png'),
|
|
511
|
+
'phpmailer_mini.png";.jpg'
|
|
512
|
+
);
|
|
513
|
+
$this->Mail->addAttachment(
|
|
514
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer.png'),
|
|
515
|
+
'phpmailer.png'
|
|
516
|
+
);
|
|
517
|
+
$this->Mail->addAttachment(
|
|
518
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/PHPMailer card logo.png'),
|
|
519
|
+
'PHPMailer card logo.png'
|
|
520
|
+
);
|
|
521
|
+
$this->Mail->addAttachment(
|
|
522
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer_mini.png'),
|
|
523
|
+
'phpmailer_mini.png\\\";.jpg'
|
|
524
|
+
);
|
|
525
|
+
$this->buildBody();
|
|
526
|
+
$this->Mail->preSend();
|
|
527
|
+
$message = $this->Mail->getSentMIMEMessage();
|
|
528
|
+
self::assertStringContainsString(
|
|
529
|
+
'Content-Type: image/png; name="phpmailer_mini.png\";.jpg"',
|
|
530
|
+
$message,
|
|
531
|
+
'Name containing double quote should be escaped in Content-Type'
|
|
532
|
+
);
|
|
533
|
+
self::assertStringContainsString(
|
|
534
|
+
'Content-Disposition: attachment; filename="phpmailer_mini.png\";.jpg"',
|
|
535
|
+
$message,
|
|
536
|
+
'Filename containing double quote should be escaped in Content-Disposition'
|
|
537
|
+
);
|
|
538
|
+
self::assertStringContainsString(
|
|
539
|
+
'Content-Type: image/png; name=phpmailer.png',
|
|
540
|
+
$message,
|
|
541
|
+
'Name without special chars should not be quoted in Content-Type'
|
|
542
|
+
);
|
|
543
|
+
self::assertStringContainsString(
|
|
544
|
+
'Content-Disposition: attachment; filename=phpmailer.png',
|
|
545
|
+
$message,
|
|
546
|
+
'Filename without special chars should not be quoted in Content-Disposition'
|
|
547
|
+
);
|
|
548
|
+
self::assertStringContainsString(
|
|
549
|
+
'Content-Type: image/png; name="PHPMailer card logo.png"',
|
|
550
|
+
$message,
|
|
551
|
+
'Name with spaces should be quoted in Content-Type'
|
|
552
|
+
);
|
|
553
|
+
self::assertStringContainsString(
|
|
554
|
+
'Content-Disposition: attachment; filename="PHPMailer card logo.png"',
|
|
555
|
+
$message,
|
|
556
|
+
'Filename with spaces should be quoted in Content-Disposition'
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Simple HTML and multiple attachment test.
|
|
562
|
+
*/
|
|
563
|
+
public function testHTMLMultiAttachment()
|
|
564
|
+
{
|
|
565
|
+
$this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
|
|
566
|
+
$this->Mail->Subject .= ': HTML + multiple Attachment';
|
|
567
|
+
$this->Mail->isHTML(true);
|
|
568
|
+
|
|
569
|
+
if (
|
|
570
|
+
!$this->Mail->addAttachment(
|
|
571
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer_mini.png'),
|
|
572
|
+
'phpmailer_mini.png'
|
|
573
|
+
)
|
|
574
|
+
) {
|
|
575
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
576
|
+
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (
|
|
581
|
+
!$this->Mail->addAttachment(
|
|
582
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer.png'),
|
|
583
|
+
'phpmailer.png'
|
|
584
|
+
)
|
|
585
|
+
) {
|
|
586
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
587
|
+
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
$this->buildBody();
|
|
592
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* An embedded attachment test.
|
|
597
|
+
*/
|
|
598
|
+
public function testEmbeddedImage()
|
|
599
|
+
{
|
|
600
|
+
$this->Mail->From = '';
|
|
601
|
+
$this->Mail->msgHTML('<!DOCTYPE html>
|
|
602
|
+
<html lang="en">
|
|
603
|
+
<head>
|
|
604
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
605
|
+
<title>E-Mail Inline Image Test</title>
|
|
606
|
+
</head>
|
|
607
|
+
<body>
|
|
608
|
+
<p><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="></p>
|
|
609
|
+
</body>
|
|
610
|
+
</html>');
|
|
611
|
+
$this->Mail->preSend();
|
|
612
|
+
self::assertStringContainsString(
|
|
613
|
+
'Content-ID: <bb229a48bee31f5d54ca12dc9bd960c6@phpmailer.0>',
|
|
614
|
+
$this->Mail->getSentMIMEMessage(),
|
|
615
|
+
'Embedded image header encoding incorrect.'
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* An embedded attachment test with custom cid domain.
|
|
621
|
+
*/
|
|
622
|
+
public function testEmbeddedImageCustomCidDomain()
|
|
623
|
+
{
|
|
624
|
+
$result = $this->Mail->setFrom('test@example.com');
|
|
625
|
+
self::assertTrue($result, 'setFrom failed');
|
|
626
|
+
|
|
627
|
+
$this->Mail->msgHTML('<!DOCTYPE html>
|
|
628
|
+
<html lang="en">
|
|
629
|
+
<head>
|
|
630
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
631
|
+
<title>E-Mail Inline Image Test</title>
|
|
632
|
+
</head>
|
|
633
|
+
<body>
|
|
634
|
+
<p><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="></p>
|
|
635
|
+
</body>
|
|
636
|
+
</html>', '', false);
|
|
637
|
+
$this->Mail->preSend();
|
|
638
|
+
self::assertStringContainsString(
|
|
639
|
+
'Content-ID: <bb229a48bee31f5d54ca12dc9bd960c6@example.com>',
|
|
640
|
+
$this->Mail->getSentMIMEMessage(),
|
|
641
|
+
'Embedded image header encoding incorrect.'
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* An embedded attachment test.
|
|
647
|
+
*/
|
|
648
|
+
public function testMultiEmbeddedImage()
|
|
649
|
+
{
|
|
650
|
+
$this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="' .
|
|
651
|
+
'cid:my-attach">' .
|
|
652
|
+
'Here is an image!</a>';
|
|
653
|
+
$this->Mail->Subject .= ': Embedded Image + Attachment';
|
|
654
|
+
$this->Mail->isHTML(true);
|
|
655
|
+
|
|
656
|
+
if (
|
|
657
|
+
!$this->Mail->addEmbeddedImage(
|
|
658
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer.png'),
|
|
659
|
+
'my-attach',
|
|
660
|
+
'phpmailer.png',
|
|
661
|
+
'base64',
|
|
662
|
+
'image/png'
|
|
663
|
+
)
|
|
664
|
+
) {
|
|
665
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
666
|
+
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
|
|
671
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
672
|
+
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
$this->buildBody();
|
|
677
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Simple multipart/alternative test.
|
|
682
|
+
*/
|
|
683
|
+
public function testAltBody()
|
|
684
|
+
{
|
|
685
|
+
$this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
|
|
686
|
+
$this->Mail->AltBody = 'Here is the plain text body of this message. ' .
|
|
687
|
+
'It should be quite a few lines. It should be wrapped at ' .
|
|
688
|
+
'40 characters. Make sure that it is.';
|
|
689
|
+
$this->Mail->WordWrap = 40;
|
|
690
|
+
$this->addNote('This is a multipart/alternative email');
|
|
691
|
+
$this->Mail->Subject .= ': AltBody + Word Wrap';
|
|
692
|
+
|
|
693
|
+
$this->buildBody();
|
|
694
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Simple HTML and attachment test.
|
|
699
|
+
*/
|
|
700
|
+
public function testAltBodyAttachment()
|
|
701
|
+
{
|
|
702
|
+
$this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
|
|
703
|
+
$this->Mail->AltBody = 'This is the text part of the email.';
|
|
704
|
+
$this->Mail->Subject .= ': AltBody + Attachment';
|
|
705
|
+
$this->Mail->isHTML(true);
|
|
706
|
+
|
|
707
|
+
if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) {
|
|
708
|
+
self::assertTrue(false, $this->Mail->ErrorInfo);
|
|
709
|
+
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
//Test using non-existent UNC path
|
|
714
|
+
self::assertFalse($this->Mail->addAttachment('\\\\nowhere\\nothing'));
|
|
715
|
+
|
|
716
|
+
$this->buildBody();
|
|
717
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Test sending multiple messages with separate connections.
|
|
722
|
+
*/
|
|
723
|
+
public function testMultipleSend()
|
|
724
|
+
{
|
|
725
|
+
$this->Mail->Body = 'Sending two messages without keepalive';
|
|
726
|
+
$this->buildBody();
|
|
727
|
+
$subject = $this->Mail->Subject;
|
|
728
|
+
|
|
729
|
+
$this->Mail->Subject = $subject . ': SMTP 1';
|
|
730
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
731
|
+
|
|
732
|
+
$this->Mail->Subject = $subject . ': SMTP 2';
|
|
733
|
+
$this->Mail->Sender = 'blah@example.com';
|
|
734
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Test sending an empty body.
|
|
739
|
+
*/
|
|
740
|
+
public function testEmptyBody()
|
|
741
|
+
{
|
|
742
|
+
$this->buildBody();
|
|
743
|
+
$this->Mail->Body = '';
|
|
744
|
+
$this->Mail->Subject = $this->Mail->Subject . ': Empty Body';
|
|
745
|
+
$this->Mail->isMail();
|
|
746
|
+
$this->Mail->AllowEmpty = true;
|
|
747
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
748
|
+
$this->Mail->AllowEmpty = false;
|
|
749
|
+
self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Test keepalive (sending multiple messages in a single connection).
|
|
754
|
+
*/
|
|
755
|
+
public function testSmtpKeepAlive()
|
|
756
|
+
{
|
|
757
|
+
$this->Mail->Body = 'SMTP keep-alive test.';
|
|
758
|
+
$this->buildBody();
|
|
759
|
+
$subject = $this->Mail->Subject;
|
|
760
|
+
|
|
761
|
+
$this->Mail->SMTPKeepAlive = true;
|
|
762
|
+
$this->Mail->Subject = $subject . ': SMTP keep-alive 1';
|
|
763
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
764
|
+
|
|
765
|
+
$this->Mail->Subject = $subject . ': SMTP keep-alive 2';
|
|
766
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
767
|
+
$this->Mail->smtpClose();
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Test addressing.
|
|
772
|
+
*/
|
|
773
|
+
public function testAddressing()
|
|
774
|
+
{
|
|
775
|
+
self::assertFalse($this->Mail->addAddress(''), 'Empty address accepted');
|
|
776
|
+
self::assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted');
|
|
777
|
+
self::assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted');
|
|
778
|
+
self::assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
|
|
779
|
+
self::assertTrue($this->Mail->addAddress('nullname@example.com', null), 'Null name not ignored');
|
|
780
|
+
self::assertTrue(
|
|
781
|
+
$this->Mail->addAddress('objectname@example.com', new \stdClass()),
|
|
782
|
+
'Object as name not ignored'
|
|
783
|
+
);
|
|
784
|
+
self::assertTrue($this->Mail->addAddress('arrayname@example.com', [1,2,3]), 'Array as name not ignored');
|
|
785
|
+
self::assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
|
|
786
|
+
self::assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
|
|
787
|
+
self::assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
|
|
788
|
+
self::assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
|
|
789
|
+
self::assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
|
|
790
|
+
self::assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
|
|
791
|
+
self::assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
|
|
792
|
+
$this->Mail->clearCCs();
|
|
793
|
+
$this->Mail->clearBCCs();
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Test address escaping.
|
|
798
|
+
*/
|
|
799
|
+
public function testAddressEscaping()
|
|
800
|
+
{
|
|
801
|
+
$this->Mail->Subject .= ': Address escaping';
|
|
802
|
+
$this->Mail->clearAddresses();
|
|
803
|
+
$this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly');
|
|
804
|
+
$this->Mail->Body = 'Test correct escaping of quotes in addresses.';
|
|
805
|
+
$this->buildBody();
|
|
806
|
+
$this->Mail->preSend();
|
|
807
|
+
$b = $this->Mail->getSentMIMEMessage();
|
|
808
|
+
self::assertStringContainsString('To: "Tim \"The Book\" O\'Reilly" <foo@example.com>', $b);
|
|
809
|
+
|
|
810
|
+
$this->Mail->Subject .= ': Address escaping invalid';
|
|
811
|
+
$this->Mail->clearAddresses();
|
|
812
|
+
$this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly');
|
|
813
|
+
$this->Mail->addAddress('invalidaddressexample.com', 'invalidaddress');
|
|
814
|
+
$this->Mail->Body = 'invalid address';
|
|
815
|
+
$this->buildBody();
|
|
816
|
+
$this->Mail->preSend();
|
|
817
|
+
self::assertSame('Invalid address: (to): invalidaddressexample.com', $this->Mail->ErrorInfo);
|
|
818
|
+
|
|
819
|
+
$this->Mail->addAttachment(
|
|
820
|
+
realpath(\PHPMAILER_INCLUDE_DIR . '/examples/images/phpmailer_mini.png'),
|
|
821
|
+
'phpmailer_mini.png'
|
|
822
|
+
);
|
|
823
|
+
self::assertTrue($this->Mail->attachmentExists());
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Test MIME structure assembly.
|
|
828
|
+
*/
|
|
829
|
+
public function testMIMEStructure()
|
|
830
|
+
{
|
|
831
|
+
$this->Mail->Subject .= ': MIME structure';
|
|
832
|
+
$this->Mail->Body = '<h3>MIME structure test.</h3>';
|
|
833
|
+
$this->Mail->AltBody = 'MIME structure test.';
|
|
834
|
+
$this->buildBody();
|
|
835
|
+
$this->Mail->preSend();
|
|
836
|
+
self::assertMatchesRegularExpression(
|
|
837
|
+
"/Content-Transfer-Encoding: 8bit\r\n\r\n/",
|
|
838
|
+
$this->Mail->getSentMIMEMessage(),
|
|
839
|
+
'MIME structure broken'
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Test BCC-only addressing.
|
|
845
|
+
*/
|
|
846
|
+
public function testBCCAddressing()
|
|
847
|
+
{
|
|
848
|
+
$this->Mail->isSMTP();
|
|
849
|
+
$this->Mail->Subject .= ': BCC-only addressing';
|
|
850
|
+
$this->buildBody();
|
|
851
|
+
$this->Mail->clearAllRecipients();
|
|
852
|
+
self::assertTrue($this->Mail->addBCC('a@example.com'), 'BCC addressing failed');
|
|
853
|
+
$this->Mail->preSend();
|
|
854
|
+
$b = $this->Mail->getSentMIMEMessage();
|
|
855
|
+
self::assertStringNotContainsString('a@example.com', $b);
|
|
856
|
+
self::assertTrue($this->Mail->send(), 'send failed');
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Expect exceptions on bad encoding
|
|
861
|
+
*/
|
|
862
|
+
public function testAddAttachmentEncodingException()
|
|
863
|
+
{
|
|
864
|
+
$this->expectException(Exception::class);
|
|
865
|
+
|
|
866
|
+
$mail = new PHPMailer(true);
|
|
867
|
+
$mail->addAttachment(__FILE__, 'test.txt', 'invalidencoding');
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Expect errors on trying to attach a folder as an attachment
|
|
872
|
+
*/
|
|
873
|
+
public function testAddFolderAsAttachment()
|
|
874
|
+
{
|
|
875
|
+
$mail = new PHPMailer();
|
|
876
|
+
self::assertFalse($mail->addAttachment(__DIR__, 'test.txt'));
|
|
877
|
+
|
|
878
|
+
$this->expectException(Exception::class);
|
|
879
|
+
$mail = new PHPMailer(true);
|
|
880
|
+
$mail->addAttachment(__DIR__, 'test.txt');
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Expect exceptions on sending after deleting a previously successfully attached file
|
|
886
|
+
*/
|
|
887
|
+
public function testDeletedAttachmentException()
|
|
888
|
+
{
|
|
889
|
+
$this->expectException(Exception::class);
|
|
890
|
+
|
|
891
|
+
$filename = __FILE__ . md5(microtime()) . 'test.txt';
|
|
892
|
+
touch($filename);
|
|
893
|
+
$this->Mail = new PHPMailer(true);
|
|
894
|
+
$this->Mail->addAttachment($filename);
|
|
895
|
+
unlink($filename);
|
|
896
|
+
$this->Mail->send();
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Expect error on sending after deleting a previously successfully attached file
|
|
901
|
+
*/
|
|
902
|
+
public function testDeletedAttachmentError()
|
|
903
|
+
{
|
|
904
|
+
$filename = __FILE__ . md5(microtime()) . 'test.txt';
|
|
905
|
+
touch($filename);
|
|
906
|
+
$this->Mail = new PHPMailer();
|
|
907
|
+
$this->Mail->addAttachment($filename);
|
|
908
|
+
unlink($filename);
|
|
909
|
+
self::assertFalse($this->Mail->send());
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Test base-64 encoding.
|
|
914
|
+
*/
|
|
915
|
+
public function testBase64()
|
|
916
|
+
{
|
|
917
|
+
$this->Mail->Subject .= ': Base-64 encoding';
|
|
918
|
+
$this->Mail->Encoding = 'base64';
|
|
919
|
+
$this->buildBody();
|
|
920
|
+
self::assertTrue($this->Mail->send(), 'Base64 encoding failed');
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* S/MIME Signing tests (self-signed).
|
|
925
|
+
*
|
|
926
|
+
* @requires extension openssl
|
|
927
|
+
*/
|
|
928
|
+
public function testSigning()
|
|
929
|
+
{
|
|
930
|
+
$this->Mail->Subject .= ': S/MIME signing';
|
|
931
|
+
$this->Mail->Body = 'This message is S/MIME signed.';
|
|
932
|
+
$this->buildBody();
|
|
933
|
+
|
|
934
|
+
$dn = [
|
|
935
|
+
'countryName' => 'UK',
|
|
936
|
+
'stateOrProvinceName' => 'Here',
|
|
937
|
+
'localityName' => 'There',
|
|
938
|
+
'organizationName' => 'PHP',
|
|
939
|
+
'organizationalUnitName' => 'PHPMailer',
|
|
940
|
+
'commonName' => 'PHPMailer Test',
|
|
941
|
+
'emailAddress' => 'phpmailer@example.com',
|
|
942
|
+
];
|
|
943
|
+
$keyconfig = [
|
|
944
|
+
'digest_alg' => 'sha256',
|
|
945
|
+
'private_key_bits' => 2048,
|
|
946
|
+
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
|
947
|
+
];
|
|
948
|
+
$password = 'password';
|
|
949
|
+
$certfile = 'certfile.pem';
|
|
950
|
+
$keyfile = 'keyfile.pem';
|
|
951
|
+
|
|
952
|
+
//Make a new key pair
|
|
953
|
+
$pk = openssl_pkey_new($keyconfig);
|
|
954
|
+
//Create a certificate signing request
|
|
955
|
+
$csr = openssl_csr_new($dn, $pk);
|
|
956
|
+
//Create a self-signed cert
|
|
957
|
+
$cert = openssl_csr_sign($csr, null, $pk, 1);
|
|
958
|
+
//Save the cert
|
|
959
|
+
openssl_x509_export($cert, $certout);
|
|
960
|
+
file_put_contents($certfile, $certout);
|
|
961
|
+
//Save the key
|
|
962
|
+
openssl_pkey_export($pk, $pkeyout, $password);
|
|
963
|
+
file_put_contents($keyfile, $pkeyout);
|
|
964
|
+
|
|
965
|
+
$this->Mail->sign(
|
|
966
|
+
$certfile,
|
|
967
|
+
$keyfile,
|
|
968
|
+
$password
|
|
969
|
+
);
|
|
970
|
+
self::assertTrue($this->Mail->send(), 'S/MIME signing failed');
|
|
971
|
+
|
|
972
|
+
$msg = $this->Mail->getSentMIMEMessage();
|
|
973
|
+
self::assertStringNotContainsString("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
|
974
|
+
unlink($certfile);
|
|
975
|
+
unlink($keyfile);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* S/MIME Signing tests using a CA chain cert.
|
|
980
|
+
* To test that a generated message is signed correctly, save the message in a file called `signed.eml`
|
|
981
|
+
* and use openssl along with the certs generated by this script:
|
|
982
|
+
* `openssl smime -verify -in signed.eml -signer certfile.pem -CAfile cacertfile.pem`.
|
|
983
|
+
*
|
|
984
|
+
* @requires extension openssl
|
|
985
|
+
*/
|
|
986
|
+
public function testSigningWithCA()
|
|
987
|
+
{
|
|
988
|
+
$this->Mail->Subject .= ': S/MIME signing with CA';
|
|
989
|
+
$this->Mail->Body = 'This message is S/MIME signed with an extra CA cert.';
|
|
990
|
+
$this->buildBody();
|
|
991
|
+
|
|
992
|
+
$certprops = [
|
|
993
|
+
'countryName' => 'UK',
|
|
994
|
+
'stateOrProvinceName' => 'Here',
|
|
995
|
+
'localityName' => 'There',
|
|
996
|
+
'organizationName' => 'PHP',
|
|
997
|
+
'organizationalUnitName' => 'PHPMailer',
|
|
998
|
+
'commonName' => 'PHPMailer Test',
|
|
999
|
+
'emailAddress' => 'phpmailer@example.com',
|
|
1000
|
+
];
|
|
1001
|
+
$cacertprops = [
|
|
1002
|
+
'countryName' => 'UK',
|
|
1003
|
+
'stateOrProvinceName' => 'Here',
|
|
1004
|
+
'localityName' => 'There',
|
|
1005
|
+
'organizationName' => 'PHP',
|
|
1006
|
+
'organizationalUnitName' => 'PHPMailer CA',
|
|
1007
|
+
'commonName' => 'PHPMailer Test CA',
|
|
1008
|
+
'emailAddress' => 'phpmailer@example.com',
|
|
1009
|
+
];
|
|
1010
|
+
$keyconfig = [
|
|
1011
|
+
'digest_alg' => 'sha256',
|
|
1012
|
+
'private_key_bits' => 2048,
|
|
1013
|
+
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
|
1014
|
+
];
|
|
1015
|
+
$password = 'password';
|
|
1016
|
+
$cacertfile = 'cacertfile.pem';
|
|
1017
|
+
$cakeyfile = 'cakeyfile.pem';
|
|
1018
|
+
$certfile = 'certfile.pem';
|
|
1019
|
+
$keyfile = 'keyfile.pem';
|
|
1020
|
+
|
|
1021
|
+
//Create a CA cert
|
|
1022
|
+
//Make a new key pair
|
|
1023
|
+
$capk = openssl_pkey_new($keyconfig);
|
|
1024
|
+
//Create a certificate signing request
|
|
1025
|
+
$csr = openssl_csr_new($cacertprops, $capk);
|
|
1026
|
+
//Create a self-signed cert
|
|
1027
|
+
$cert = openssl_csr_sign($csr, null, $capk, 1);
|
|
1028
|
+
//Save the CA cert
|
|
1029
|
+
openssl_x509_export($cert, $certout);
|
|
1030
|
+
file_put_contents($cacertfile, $certout);
|
|
1031
|
+
//Save the CA key
|
|
1032
|
+
openssl_pkey_export($capk, $pkeyout, $password);
|
|
1033
|
+
file_put_contents($cakeyfile, $pkeyout);
|
|
1034
|
+
|
|
1035
|
+
//Create a cert signed by our CA
|
|
1036
|
+
//Make a new key pair
|
|
1037
|
+
$pk = openssl_pkey_new($keyconfig);
|
|
1038
|
+
//Create a certificate signing request
|
|
1039
|
+
$csr = openssl_csr_new($certprops, $pk);
|
|
1040
|
+
//Create a self-signed cert
|
|
1041
|
+
$cacert = file_get_contents($cacertfile);
|
|
1042
|
+
$cert = openssl_csr_sign($csr, $cacert, $capk, 1);
|
|
1043
|
+
//Save the cert
|
|
1044
|
+
openssl_x509_export($cert, $certout);
|
|
1045
|
+
file_put_contents($certfile, $certout);
|
|
1046
|
+
//Save the key
|
|
1047
|
+
openssl_pkey_export($pk, $pkeyout, $password);
|
|
1048
|
+
file_put_contents($keyfile, $pkeyout);
|
|
1049
|
+
|
|
1050
|
+
$this->Mail->sign(
|
|
1051
|
+
$certfile,
|
|
1052
|
+
$keyfile,
|
|
1053
|
+
$password,
|
|
1054
|
+
$cacertfile
|
|
1055
|
+
);
|
|
1056
|
+
self::assertTrue($this->Mail->send(), 'S/MIME signing with CA failed');
|
|
1057
|
+
unlink($cacertfile);
|
|
1058
|
+
unlink($cakeyfile);
|
|
1059
|
+
unlink($certfile);
|
|
1060
|
+
unlink($keyfile);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Test line break reformatting.
|
|
1065
|
+
*/
|
|
1066
|
+
public function testLineBreaks()
|
|
1067
|
+
{
|
|
1068
|
+
//May have been altered by earlier tests, can interfere with line break format
|
|
1069
|
+
$this->Mail->isSMTP();
|
|
1070
|
+
$this->Mail->preSend();
|
|
1071
|
+
|
|
1072
|
+
//To see accurate results when using postfix, set `sendmail_fix_line_endings = never` in main.cf
|
|
1073
|
+
$this->Mail->Subject = 'PHPMailer DOS line breaks';
|
|
1074
|
+
$this->Mail->Body = "This message\r\ncontains\r\nDOS-format\r\nCRLF line breaks.";
|
|
1075
|
+
self::assertTrue($this->Mail->send());
|
|
1076
|
+
|
|
1077
|
+
$this->Mail->Subject = 'PHPMailer UNIX line breaks';
|
|
1078
|
+
$this->Mail->Body = "This message\ncontains\nUNIX-format\nLF line breaks.";
|
|
1079
|
+
self::assertTrue($this->Mail->send());
|
|
1080
|
+
|
|
1081
|
+
$this->Mail->Encoding = 'quoted-printable';
|
|
1082
|
+
$this->Mail->Subject = 'PHPMailer DOS line breaks, QP';
|
|
1083
|
+
$this->Mail->Body = "This message\r\ncontains\r\nDOS-format\r\nCRLF line breaks.";
|
|
1084
|
+
self::assertTrue($this->Mail->send());
|
|
1085
|
+
|
|
1086
|
+
$this->Mail->Subject = 'PHPMailer UNIX line breaks, QP';
|
|
1087
|
+
$this->Mail->Body = "This message\ncontains\nUNIX-format\nLF line breaks.";
|
|
1088
|
+
self::assertTrue($this->Mail->send());
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Miscellaneous calls to improve test coverage and some small tests.
|
|
1093
|
+
*/
|
|
1094
|
+
public function testMiscellaneous()
|
|
1095
|
+
{
|
|
1096
|
+
$this->Mail->clearAttachments();
|
|
1097
|
+
$this->Mail->isHTML(false);
|
|
1098
|
+
$this->Mail->isSMTP();
|
|
1099
|
+
$this->Mail->isMail();
|
|
1100
|
+
$this->Mail->isSendmail();
|
|
1101
|
+
$this->Mail->isQmail();
|
|
1102
|
+
$this->Mail->Sender = '';
|
|
1103
|
+
self::assertEmpty($this->Mail->Sender);
|
|
1104
|
+
$this->Mail->createHeader();
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
public function testBadSMTP()
|
|
1108
|
+
{
|
|
1109
|
+
$this->Mail->smtpConnect();
|
|
1110
|
+
$smtp = $this->Mail->getSMTPInstance();
|
|
1111
|
+
self::assertFalse($smtp->mail("somewhere\nbad"), 'Bad SMTP command containing breaks accepted');
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Tests setting and retrieving ConfirmReadingTo address, also known as "read receipt" address.
|
|
1116
|
+
*/
|
|
1117
|
+
public function testConfirmReadingTo()
|
|
1118
|
+
{
|
|
1119
|
+
$this->Mail->CharSet = PHPMailer::CHARSET_UTF8;
|
|
1120
|
+
$this->buildBody();
|
|
1121
|
+
|
|
1122
|
+
$this->Mail->ConfirmReadingTo = 'test@example..com'; //Invalid address
|
|
1123
|
+
self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1124
|
+
|
|
1125
|
+
$this->Mail->ConfirmReadingTo = ' test@example.com'; //Extra space to trim
|
|
1126
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1127
|
+
self::assertSame(
|
|
1128
|
+
'test@example.com',
|
|
1129
|
+
$this->Mail->ConfirmReadingTo,
|
|
1130
|
+
'Unexpected read receipt address'
|
|
1131
|
+
);
|
|
1132
|
+
|
|
1133
|
+
$letter = html_entity_decode('ç', ENT_COMPAT, PHPMailer::CHARSET_UTF8);
|
|
1134
|
+
$this->Mail->ConfirmReadingTo = 'test@fran' . $letter . 'ois.ch'; //Address with IDN
|
|
1135
|
+
if (PHPMailer::idnSupported()) {
|
|
1136
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1137
|
+
self::assertSame(
|
|
1138
|
+
'test@xn--franois-xxa.ch',
|
|
1139
|
+
$this->Mail->ConfirmReadingTo,
|
|
1140
|
+
'IDN address not converted to punycode'
|
|
1141
|
+
);
|
|
1142
|
+
} else {
|
|
1143
|
+
self::assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.
|
|
1149
|
+
*/
|
|
1150
|
+
public function testConvertEncoding()
|
|
1151
|
+
{
|
|
1152
|
+
if (!PHPMailer::idnSupported()) {
|
|
1153
|
+
self::markTestSkipped('Both intl and mbstring extensions are required.');
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
$this->Mail->clearAllRecipients();
|
|
1157
|
+
|
|
1158
|
+
//This file is UTF-8 encoded so we have to take a roundabout route
|
|
1159
|
+
//to make a domain using an ISO-8859-1 character.
|
|
1160
|
+
$letter = html_entity_decode('ç', ENT_COMPAT, PHPMailer::CHARSET_ISO88591);
|
|
1161
|
+
$domain = '@' . 'fran' . $letter . 'ois.ch';
|
|
1162
|
+
$this->Mail->addAddress('test' . $domain);
|
|
1163
|
+
$this->Mail->addCC('test+cc' . $domain);
|
|
1164
|
+
$this->Mail->addBCC('test+bcc' . $domain);
|
|
1165
|
+
|
|
1166
|
+
//Queued addresses are not returned by get*Addresses() before send() call.
|
|
1167
|
+
self::assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients');
|
|
1168
|
+
self::assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients');
|
|
1169
|
+
self::assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
|
|
1170
|
+
|
|
1171
|
+
//Clear queued BCC recipient.
|
|
1172
|
+
$this->Mail->clearBCCs();
|
|
1173
|
+
|
|
1174
|
+
$this->buildBody();
|
|
1175
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1176
|
+
|
|
1177
|
+
//Addresses with IDN are returned by get*Addresses() after send() call.
|
|
1178
|
+
$domain = $this->Mail->punyencodeAddress($domain);
|
|
1179
|
+
self::assertSame(
|
|
1180
|
+
[['test' . $domain, '']],
|
|
1181
|
+
$this->Mail->getToAddresses(),
|
|
1182
|
+
'Bad "to" recipients'
|
|
1183
|
+
);
|
|
1184
|
+
self::assertSame(
|
|
1185
|
+
[['test+cc' . $domain, '']],
|
|
1186
|
+
$this->Mail->getCcAddresses(),
|
|
1187
|
+
'Bad "cc" recipients'
|
|
1188
|
+
);
|
|
1189
|
+
self::assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Tests removal of duplicate recipients and reply-tos.
|
|
1194
|
+
*/
|
|
1195
|
+
public function testDuplicateIDNRemoved()
|
|
1196
|
+
{
|
|
1197
|
+
if (!PHPMailer::idnSupported()) {
|
|
1198
|
+
self::markTestSkipped('Both intl and mbstring extensions are required.');
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
$this->Mail->clearAllRecipients();
|
|
1202
|
+
|
|
1203
|
+
$this->Mail->CharSet = PHPMailer::CHARSET_UTF8;
|
|
1204
|
+
|
|
1205
|
+
self::assertTrue($this->Mail->addAddress('test@françois.ch'));
|
|
1206
|
+
self::assertFalse($this->Mail->addAddress('test@françois.ch'));
|
|
1207
|
+
self::assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH'));
|
|
1208
|
+
self::assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH'));
|
|
1209
|
+
self::assertTrue($this->Mail->addAddress('test@xn--franois-xxa.ch'));
|
|
1210
|
+
self::assertFalse($this->Mail->addAddress('test@xn--franois-xxa.ch'));
|
|
1211
|
+
self::assertFalse($this->Mail->addAddress('test@XN--FRANOIS-XXA.CH'));
|
|
1212
|
+
|
|
1213
|
+
$this->buildBody();
|
|
1214
|
+
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
|
1215
|
+
|
|
1216
|
+
//There should be only one "To" address and one "Reply-To" address.
|
|
1217
|
+
self::assertCount(
|
|
1218
|
+
1,
|
|
1219
|
+
$this->Mail->getToAddresses(),
|
|
1220
|
+
'Bad count of "to" recipients'
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* Test that validation doesn't accidentally succeed.
|
|
1226
|
+
*/
|
|
1227
|
+
public function testUnsupportedSmtpUTF8()
|
|
1228
|
+
{
|
|
1229
|
+
self::assertFalse(PHPMailer::validateAddress('spın̈altap@example.com', 'html5'));
|
|
1230
|
+
self::assertTrue(PHPMailer::validateAddress('spın̈altap@example.com', 'eai'));
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* The eai regex is complex and warrants a few extra tests.
|
|
1235
|
+
*/
|
|
1236
|
+
public function testStrangeUnicodeEmailAddresses()
|
|
1237
|
+
{
|
|
1238
|
+
PHPMailer::$validator = 'eai';
|
|
1239
|
+
self::assertTrue(PHPMailer::validateAddress('spın̈altap@example.com'));
|
|
1240
|
+
self::assertTrue(PHPMailer::validateAddress('spın̈altap@spın̈altap.com'));
|
|
1241
|
+
self::assertTrue(PHPMailer::validateAddress('दूकान@मेरी.दूकान.भारत'));
|
|
1242
|
+
self::assertTrue(PHPMailer::validateAddress('慕田峪长城@慕田峪长城.网址'));
|
|
1243
|
+
self::assertFalse(PHPMailer::validateAddress('慕田峪长城@慕田峪长城。网址'));
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Test that SMTPUTF8 is allowed unless the caller has made a conscious choice against it.
|
|
1248
|
+
*/
|
|
1249
|
+
public function testAutomaticEaiValidation()
|
|
1250
|
+
{
|
|
1251
|
+
$this->Mail = new PHPMailer(true);
|
|
1252
|
+
PHPMailer::$validator = 'php';
|
|
1253
|
+
$this->Mail->Body = 'Test';
|
|
1254
|
+
$this->Mail->isSMTP();
|
|
1255
|
+
self::assertTrue($this->Mail->addAddress('spın̈altap@example.com', ''));
|
|
1256
|
+
$this->Mail->preSend();
|
|
1257
|
+
self::assertTrue($this->Mail->needsSMTPUTF8());
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Test SMTPUTF8 usage, including when it is not to be used.
|
|
1262
|
+
*/
|
|
1263
|
+
public function testSmtpUTF8()
|
|
1264
|
+
{
|
|
1265
|
+
PHPMailer::$validator = 'php';
|
|
1266
|
+
$this->Mail = new PHPMailer(true);
|
|
1267
|
+
$this->Mail->Body = 'Test';
|
|
1268
|
+
$this->Mail->isSMTP();
|
|
1269
|
+
$this->Mail->addAddress('foo@example.com', '');
|
|
1270
|
+
$this->Mail->preSend();
|
|
1271
|
+
self::assertFalse($this->Mail->needsSMTPUTF8());
|
|
1272
|
+
|
|
1273
|
+
//Beyond this point we need UTF-8 support
|
|
1274
|
+
if (!PHPMailer::idnSupported()) {
|
|
1275
|
+
self::markTestSkipped('Both intl and mbstring extensions are required.');
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
//Using a punycodable domain does not need SMTPUTF8
|
|
1279
|
+
self::assertFalse($this->Mail->needsSMTPUTF8());
|
|
1280
|
+
$this->Mail->addAddress('foo@spın̈altap.example', '');
|
|
1281
|
+
$this->Mail->preSend();
|
|
1282
|
+
self::assertFalse($this->Mail->needsSMTPUTF8());
|
|
1283
|
+
|
|
1284
|
+
//Need to use SMTPUTF8, and can.
|
|
1285
|
+
self::assertTrue($this->Mail->addAddress('spın̈altap@example.com', ''));
|
|
1286
|
+
$this->Mail->preSend();
|
|
1287
|
+
self::assertTrue($this->Mail->needsSMTPUTF8());
|
|
1288
|
+
|
|
1289
|
+
//If using SMTPUTF8, then the To header should contain
|
|
1290
|
+
//Unicode@Unicode, for better rendering by clients like Mac
|
|
1291
|
+
//Outlook.
|
|
1292
|
+
$this->Mail->addAddress('spın̈altap@spın̈altap.invalid', '');
|
|
1293
|
+
$this->Mail->preSend();
|
|
1294
|
+
self::assertStringContainsString('spın̈altap@spın̈altap.invalid', $this->Mail->createHeader());
|
|
1295
|
+
|
|
1296
|
+
//Sending unencoded UTF8 is legal when SMTPUTF8 is used,
|
|
1297
|
+
//except that body parts have to be encoded if they
|
|
1298
|
+
//accidentally contain any lines that match the MIME boundary
|
|
1299
|
+
//lines. It also looks good, so let's do it.
|
|
1300
|
+
|
|
1301
|
+
$this->Mail->Subject = 'Spın̈al Tap';
|
|
1302
|
+
self::assertStringContainsString('Spın̈al', $this->Mail->createHeader());
|
|
1303
|
+
$this->Mail->Body = 'Spın̈al Tap';
|
|
1304
|
+
$this->Mail->preSend();
|
|
1305
|
+
self::assertStringContainsString('Spın̈al', $this->Mail->createBody());
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Test SMTP Xclient options
|
|
1310
|
+
*/
|
|
1311
|
+
public function testSmtpXclient()
|
|
1312
|
+
{
|
|
1313
|
+
$this->Mail->isSMTP();
|
|
1314
|
+
$this->Mail->SMTPAuth = false;
|
|
1315
|
+
$this->Mail->setSMTPXclientAttribute('ADDR', '127.0.0.1');
|
|
1316
|
+
$this->Mail->setSMTPXclientAttribute('LOGIN', 'user@example.com');
|
|
1317
|
+
$this->Mail->setSMTPXclientAttribute('HELO', 'test.example.com');
|
|
1318
|
+
$this->assertFalse($this->Mail->setSMTPXclientAttribute('INVALID', 'value'));
|
|
1319
|
+
|
|
1320
|
+
$attributes = $this->Mail->getSMTPXclientAttributes();
|
|
1321
|
+
$this->assertEquals('test.example.com', $attributes['HELO']);
|
|
1322
|
+
|
|
1323
|
+
// remove attribute
|
|
1324
|
+
$this->Mail->setSMTPXclientAttribute('HELO', null);
|
|
1325
|
+
$attributes = $this->Mail->getSMTPXclientAttributes();
|
|
1326
|
+
$this->assertEquals(['ADDR' => '127.0.0.1', 'LOGIN' => 'user@example.com'], $attributes);
|
|
1327
|
+
|
|
1328
|
+
$this->Mail->Subject .= ': Testing XCLIENT';
|
|
1329
|
+
$this->buildBody();
|
|
1330
|
+
$this->Mail->clearAllRecipients();
|
|
1331
|
+
self::assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
|
|
1332
|
+
$this->Mail->preSend();
|
|
1333
|
+
self::assertTrue($this->Mail->send(), 'send failed');
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Test SMTP host connections.
|
|
1339
|
+
* This test can take a long time, so run it last.
|
|
1340
|
+
*
|
|
1341
|
+
* @group slow
|
|
1342
|
+
*/
|
|
1343
|
+
public function testSmtpConnect()
|
|
1344
|
+
{
|
|
1345
|
+
$this->Mail->SMTPDebug = SMTP::DEBUG_LOWLEVEL; //Show connection-level errors
|
|
1346
|
+
self::assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed');
|
|
1347
|
+
$this->Mail->smtpClose();
|
|
1348
|
+
|
|
1349
|
+
//$this->Mail->Host = 'localhost:12345;10.10.10.10:54321;' . $_REQUEST['mail_host'];
|
|
1350
|
+
//self::assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');
|
|
1351
|
+
//$this->Mail->smtpClose();
|
|
1352
|
+
//$this->Mail->Host = '[::1]:' . $this->Mail->Port . ';' . $_REQUEST['mail_host'];
|
|
1353
|
+
//self::assertTrue($this->Mail->smtpConnect(), 'SMTP IPv6 literal multi-connect failed');
|
|
1354
|
+
//$this->Mail->smtpClose();
|
|
1355
|
+
|
|
1356
|
+
//All these hosts are expected to fail
|
|
1357
|
+
//$this->Mail->Host = 'xyz://bogus:25;tls://[bogus]:25;ssl://localhost:12345;
|
|
1358
|
+
//tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10'. $_REQUEST['mail_host'].' ';
|
|
1359
|
+
//self::assertFalse($this->Mail->smtpConnect());
|
|
1360
|
+
//$this->Mail->smtpClose();
|
|
1361
|
+
|
|
1362
|
+
$this->Mail->Host = ' localhost:12345 ; ' . $_REQUEST['mail_host'] . ' ';
|
|
1363
|
+
self::assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');
|
|
1364
|
+
$this->Mail->smtpClose();
|
|
1365
|
+
|
|
1366
|
+
//Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI
|
|
1367
|
+
$this->Mail->Host = $_REQUEST['mail_host'];
|
|
1368
|
+
self::assertTrue($this->Mail->smtpConnect(['ssl' => ['verify_depth' => 10]]));
|
|
1369
|
+
|
|
1370
|
+
$this->Smtp = $this->Mail->getSMTPInstance();
|
|
1371
|
+
self::assertInstanceOf(\get_class($this->Smtp), $this->Mail->setSMTPInstance($this->Smtp));
|
|
1372
|
+
$this->Mail->smtpClose();
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* @requires extension mbstring
|
|
1377
|
+
* @requires function idn_to_ascii
|
|
1378
|
+
*/
|
|
1379
|
+
public function testGivenIdnAddress_addAddress_returns_true()
|
|
1380
|
+
{
|
|
1381
|
+
$this->assertTrue($this->Mail->addAddress('test@françois.ch'));
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
public function testErroneousAddress_addAddress_returns_false()
|
|
1385
|
+
{
|
|
1386
|
+
$this->assertFalse($this->Mail->addAddress('mehome.com'));
|
|
1387
|
+
}
|
|
1388
|
+
}
|