create-berna-stencil 1.0.14 → 1.0.16
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/.eleventy.js +1 -1
- package/.gitignore +2 -1
- package/bin/create.js +1 -1
- package/package.json +7 -6
- package/src/api/core/composer.json +1 -2
- package/src/api/core/vendor/autoload.php +1 -1
- package/src/api/core/vendor/composer/autoload_real.php +5 -5
- package/src/api/core/vendor/composer/autoload_static.php +15 -15
- package/src/api/core/vendor/composer/installed.json +7 -7
- package/src/api/core/vendor/composer/installed.php +2 -2
- package/src/api/core/vendor/graham-campbell/result-type/LICENSE +21 -21
- package/src/api/core/vendor/graham-campbell/result-type/composer.json +33 -33
- package/src/api/core/vendor/graham-campbell/result-type/src/Error.php +121 -121
- package/src/api/core/vendor/graham-campbell/result-type/src/Result.php +69 -69
- package/src/api/core/vendor/graham-campbell/result-type/src/Success.php +120 -120
- package/src/api/core/vendor/phpmailer/phpmailer/COMMITMENT +46 -46
- package/src/api/core/vendor/phpmailer/phpmailer/LICENSE +501 -501
- package/src/api/core/vendor/phpmailer/phpmailer/README.md +232 -232
- package/src/api/core/vendor/phpmailer/phpmailer/SECURITY.md +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/SMTPUTF8.md +48 -48
- package/src/api/core/vendor/phpmailer/phpmailer/VERSION +1 -1
- package/src/api/core/vendor/phpmailer/phpmailer/composer.json +84 -84
- package/src/api/core/vendor/phpmailer/phpmailer/get_oauth_token.php +182 -182
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php +26 -26
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-az.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ba.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-be.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-bg.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-cs.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php +39 -39
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-eo.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fa.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-gl.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-he.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hr.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hy.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-id.php +31 -31
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ka.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ko.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-lt.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-lv.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-mg.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ms.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php +34 -34
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php +34 -34
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php +30 -30
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr_latn.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tl.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-uk.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php +30 -30
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-vi.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php +29 -29
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +245 -245
- package/src/api/core/vendor/phpmailer/phpmailer/src/Exception.php +40 -40
- package/src/api/core/vendor/phpmailer/phpmailer/src/OAuth.php +139 -139
- package/src/api/core/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php +44 -44
- package/src/api/core/vendor/phpmailer/phpmailer/src/PHPMailer.php +5525 -5525
- package/src/api/core/vendor/phpmailer/phpmailer/src/POP3.php +470 -470
- package/src/api/core/vendor/phpmailer/phpmailer/src/SMTP.php +1617 -1617
- package/src/api/core/vendor/phpoption/phpoption/LICENSE +200 -200
- package/src/api/core/vendor/phpoption/phpoption/composer.json +50 -50
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php +175 -175
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/None.php +136 -136
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/Option.php +434 -434
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/Some.php +169 -169
- package/src/api/core/vendor/symfony/polyfill-ctype/Ctype.php +232 -232
- package/src/api/core/vendor/symfony/polyfill-ctype/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-ctype/README.md +12 -12
- package/src/api/core/vendor/symfony/polyfill-ctype/bootstrap.php +50 -50
- package/src/api/core/vendor/symfony/polyfill-ctype/bootstrap80.php +46 -46
- package/src/api/core/vendor/symfony/polyfill-ctype/composer.json +38 -38
- package/src/api/core/vendor/symfony/polyfill-mbstring/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-mbstring/Mbstring.php +1077 -1077
- package/src/api/core/vendor/symfony/polyfill-mbstring/README.md +13 -13
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -119
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1397 -1397
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +5 -5
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +1489 -1489
- package/src/api/core/vendor/symfony/polyfill-mbstring/bootstrap.php +171 -171
- package/src/api/core/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -167
- package/src/api/core/vendor/symfony/polyfill-mbstring/composer.json +39 -39
- package/src/api/core/vendor/symfony/polyfill-php80/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-php80/Php80.php +115 -115
- package/src/api/core/vendor/symfony/polyfill-php80/PhpToken.php +106 -106
- package/src/api/core/vendor/symfony/polyfill-php80/README.md +25 -25
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +31 -31
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +20 -20
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/bootstrap.php +42 -42
- package/src/api/core/vendor/symfony/polyfill-php80/composer.json +37 -37
- package/src/api/core/vendor/vlucas/phpdotenv/LICENSE +30 -30
- package/src/api/core/vendor/vlucas/phpdotenv/composer.json +60 -60
- package/src/api/core/vendor/vlucas/phpdotenv/src/Dotenv.php +267 -267
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/Loader.php +48 -48
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php +20 -20
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/Resolver.php +65 -65
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Entry.php +59 -59
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php +299 -299
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Lexer.php +58 -58
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Lines.php +127 -127
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Parser.php +53 -53
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php +19 -19
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Value.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php +15 -15
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php +89 -89
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php +80 -80
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php +85 -85
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php +110 -110
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php +48 -48
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php +64 -64
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php +91 -91
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php +17 -17
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReplacingWriter.php +104 -104
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php +27 -27
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php +107 -107
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/RepositoryBuilder.php +272 -272
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/RepositoryInterface.php +51 -51
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/File/Paths.php +44 -44
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/File/Reader.php +81 -81
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/FileStore.php +72 -72
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StoreBuilder.php +141 -141
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StoreInterface.php +17 -17
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StringStore.php +37 -37
- package/src/api/core/vendor/vlucas/phpdotenv/src/Util/Regex.php +112 -112
- package/src/api/core/vendor/vlucas/phpdotenv/src/Util/Str.php +108 -108
- package/src/api/core/vendor/vlucas/phpdotenv/src/Validator.php +207 -207
- package/src/api/endpoints/protected/{secret.php → prova-chiusa.php} +1 -1
- package/src/api/endpoints/public/{ping.php → prova-aperta.php} +1 -1
- package/src/api/core/vendor/graham-campbell/result-type/.gitattributes +0 -9
- package/src/api/core/vendor/graham-campbell/result-type/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/graham-campbell/result-type/.github/CONTRIBUTING.md +0 -31
- package/src/api/core/vendor/graham-campbell/result-type/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/graham-campbell/result-type/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/graham-campbell/result-type/.github/workflows/stale.yml +0 -11
- package/src/api/core/vendor/graham-campbell/result-type/.github/workflows/tests.yml +0 -40
- package/src/api/core/vendor/graham-campbell/result-type/CHANGELOG.md +0 -53
- package/src/api/core/vendor/graham-campbell/result-type/README.md +0 -42
- package/src/api/core/vendor/graham-campbell/result-type/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/graham-campbell/result-type/tests/ResultTest.php +0 -95
- package/src/api/core/vendor/phpmailer/phpmailer/.codecov.yml +0 -21
- package/src/api/core/vendor/phpmailer/phpmailer/.editorconfig +0 -15
- package/src/api/core/vendor/phpmailer/phpmailer/.gitattributes +0 -17
- package/src/api/core/vendor/phpmailer/phpmailer/.github/FUNDING.yml +0 -6
- package/src/api/core/vendor/phpmailer/phpmailer/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
- package/src/api/core/vendor/phpmailer/phpmailer/.github/actions/build-docs/Dockerfile +0 -15
- package/src/api/core/vendor/phpmailer/phpmailer/.github/actions/build-docs/entrypoint.sh +0 -5
- package/src/api/core/vendor/phpmailer/phpmailer/.github/dependabot.yml +0 -21
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/docs.yaml +0 -30
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/scorecards.yml +0 -61
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/tests.yml +0 -237
- package/src/api/core/vendor/phpmailer/phpmailer/.phan/config.php +0 -41
- package/src/api/core/vendor/phpmailer/phpmailer/UPGRADING.md +0 -125
- package/src/api/core/vendor/phpmailer/phpmailer/changelog.md +0 -1122
- package/src/api/core/vendor/phpmailer/phpmailer/docs/README.md +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/examples/DKIM_gen_keys.phps +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/examples/DKIM_sign.phps +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/examples/README.md +0 -96
- package/src/api/core/vendor/phpmailer/phpmailer/examples/azure_xoauth2.phps +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/examples/callback.phps +0 -76
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contactform-ajax.phps +0 -146
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contactform.phps +0 -95
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contents.html +0 -17
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contentsutf8.html +0 -23
- package/src/api/core/vendor/phpmailer/phpmailer/examples/exceptions.phps +0 -40
- package/src/api/core/vendor/phpmailer/phpmailer/examples/extending.phps +0 -72
- package/src/api/core/vendor/phpmailer/phpmailer/examples/gmail.phps +0 -106
- package/src/api/core/vendor/phpmailer/phpmailer/examples/gmail_xoauth.phps +0 -121
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.afdesign +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.svg +0 -209
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/phpmailer.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/phpmailer_mini.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/mail.phps +0 -35
- package/src/api/core/vendor/phpmailer/phpmailer/examples/mailing_list.phps +0 -96
- package/src/api/core/vendor/phpmailer/phpmailer/examples/pop_before_smtp.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/send_file_upload.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/send_multiple_file_upload.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/sendmail.phps +0 -37
- package/src/api/core/vendor/phpmailer/phpmailer/examples/sendoauth2.phps +0 -100
- package/src/api/core/vendor/phpmailer/phpmailer/examples/simple_contact_form.phps +0 -102
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smime_signed_mail.phps +0 -99
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp.phps +0 -62
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_check.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_low_memory.phps +0 -117
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_no_auth.phps +0 -53
- package/src/api/core/vendor/phpmailer/phpmailer/examples/ssl_options.phps +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/phpcs.xml.dist +0 -52
- package/src/api/core/vendor/phpmailer/phpmailer/phpdoc.dist.xml +0 -20
- package/src/api/core/vendor/phpmailer/phpmailer/phpunit.xml.dist +0 -36
- package/src/api/core/vendor/phpmailer/phpmailer/test/DebugLogTestListener.php +0 -47
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/accessible.txt +0 -1
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/inaccessible.txt +0 -1
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-fr.php +0 -10
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-nl.php +0 -10
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xa_scri_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xb_scri.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xc_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_scri.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xe.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xx.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yy.php +0 -16
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yz.php +0 -16
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-zz.php +0 -20
- package/src/api/core/vendor/phpmailer/phpmailer/test/Language/TranslationCompletenessTest.php +0 -97
- package/src/api/core/vendor/phpmailer/phpmailer/test/OAuth/OAuthTest.php +0 -76
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddEmbeddedImageTest.php +0 -178
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringAttachmentTest.php +0 -147
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringEmbeddedImageTest.php +0 -161
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddrFormatTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AuthCRAMMD5Test.php +0 -48
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/CustomHeaderTest.php +0 -285
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMTest.php +0 -258
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMWithoutExceptionsTest.php +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DSNConfiguratorTest.php +0 -221
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeQTest.php +0 -110
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeStringTest.php +0 -135
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/FileIsAccessibleTest.php +0 -103
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/FilenameToTypeTest.php +0 -74
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/GenerateIdTest.php +0 -75
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/GetLastMessageIDTest.php +0 -110
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/HasLineLongerThanMaxTest.php +0 -158
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/Html2TextTest.php +0 -231
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ICalTest.php +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/IsPermittedPathTest.php +0 -108
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/IsValidHostTest.php +0 -107
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/LocalizationTest.php +0 -505
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MailTransportTest.php +0 -261
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MbPathinfoTest.php +0 -171
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MimeTypesTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/NormalizeBreaksTest.php +0 -111
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/PHPMailerTest.php +0 -1388
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ParseAddressesTest.php +0 -321
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/PunyencodeAddressTest.php +0 -141
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/QuotedStringTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ReplyToGetSetClearTest.php +0 -444
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetErrorTest.php +0 -154
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetFromTest.php +0 -202
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetTest.php +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetWordWrapTest.php +0 -120
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/Utf8CharBoundaryTest.php +0 -66
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressCustomValidatorTest.php +0 -116
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressTest.php +0 -485
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/WrapTextTest.php +0 -125
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/XMailerTest.php +0 -75
- package/src/api/core/vendor/phpmailer/phpmailer/test/POP3/PopBeforeSmtpTest.php +0 -139
- package/src/api/core/vendor/phpmailer/phpmailer/test/PreSendTestCase.php +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/test/Security/DenialOfServiceVectorsTest.php +0 -52
- package/src/api/core/vendor/phpmailer/phpmailer/test/SendTestCase.php +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/TestCase.php +0 -392
- package/src/api/core/vendor/phpmailer/phpmailer/test/fakepopserver.sh +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/fakesendmail.sh +0 -22
- package/src/api/core/vendor/phpmailer/phpmailer/test/runfakepopserver.sh +0 -12
- package/src/api/core/vendor/phpmailer/phpmailer/test/testbootstrap-dist.php +0 -8
- package/src/api/core/vendor/phpmailer/phpmailer/test/validators.php +0 -12
- package/src/api/core/vendor/phpoption/phpoption/.gitattributes +0 -13
- package/src/api/core/vendor/phpoption/phpoption/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/phpoption/phpoption/.github/CONTRIBUTING.md +0 -30
- package/src/api/core/vendor/phpoption/phpoption/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/phpoption/phpoption/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/phpoption/phpoption/.github/workflows/static.yml +0 -40
- package/src/api/core/vendor/phpoption/phpoption/.github/workflows/tests.yml +0 -40
- package/src/api/core/vendor/phpoption/phpoption/Makefile +0 -17
- package/src/api/core/vendor/phpoption/phpoption/README.md +0 -201
- package/src/api/core/vendor/phpoption/phpoption/phpstan-baseline.neon +0 -44
- package/src/api/core/vendor/phpoption/phpoption/phpstan.neon.dist +0 -7
- package/src/api/core/vendor/phpoption/phpoption/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/EnsureTest.php +0 -72
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/LazyOptionTest.php +0 -357
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/NoneTest.php +0 -153
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/OptionTest.php +0 -166
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/SomeTest.php +0 -194
- package/src/api/core/vendor/phpoption/phpoption/tests/bootstrap.php +0 -8
- package/src/api/core/vendor/phpoption/phpoption/vendor-bin/phpstan/composer.json +0 -8
- package/src/api/core/vendor/vlucas/phpdotenv/.editorconfig +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/.gitattributes +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/vlucas/phpdotenv/.github/CONTRIBUTING.md +0 -30
- package/src/api/core/vendor/vlucas/phpdotenv/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/vlucas/phpdotenv/.github/workflows/static.yml +0 -40
- package/src/api/core/vendor/vlucas/phpdotenv/.github/workflows/tests.yml +0 -70
- package/src/api/core/vendor/vlucas/phpdotenv/Makefile +0 -17
- package/src/api/core/vendor/vlucas/phpdotenv/README.md +0 -370
- package/src/api/core/vendor/vlucas/phpdotenv/UPGRADING.md +0 -196
- package/src/api/core/vendor/vlucas/phpdotenv/phpstan-baseline.neon +0 -157
- package/src/api/core/vendor/vlucas/phpdotenv/phpstan.neon.dist +0 -7
- package/src/api/core/vendor/vlucas/phpdotenv/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/DotenvTest.php +0 -387
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Loader/LoaderTest.php +0 -86
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/EntryParserTest.php +0 -234
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LexerTest.php +0 -40
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LinesTest.php +0 -53
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/ParserTest.php +0 -98
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ArrayAdapterTest.php +0 -57
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/EnvConstAdapterTest.php +0 -75
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/PutenvAdapterTest.php +0 -52
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ServerConstAdapterTest.php +0 -75
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/RepositoryTest.php +0 -305
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Store/StoreTest.php +0 -141
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/ValidatorTest.php +0 -479
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/.env +0 -5
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/assertions.env +0 -18
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/booleans.env +0 -33
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/commented.env +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/empty.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/example.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/exported.env +0 -7
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/immutable.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/integers.env +0 -17
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/large.env +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multibyte.env +0 -3
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiline.env +0 -14
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiple.env +0 -4
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/mutable.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/nested.env +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/quoted.env +0 -11
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/specialchars.env +0 -8
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/unicodevarnames.env +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/utf8-with-bom-encoding.env +0 -3
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/windows.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/vendor-bin/phpstan/composer.json +0 -15
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
# A short history of UTF-8 in email
|
|
2
|
-
|
|
3
|
-
## Background
|
|
4
|
-
|
|
5
|
-
For most of its existence, SMTP has been a 7-bit channel, only supporting US-ASCII characters. This has been a problem for many languages, especially those that use non-Latin scripts, and has led to the development of various workarounds.
|
|
6
|
-
|
|
7
|
-
The first major improvement, introduced in 1994 in [RFC 1652](https://www.rfc-editor.org/rfc/rfc1652) and extended in 2011 in [RFC 6152](https://www.rfc-editor.org/rfc/rfc6152), was the addition of the `8BITMIME` SMTP extension, which allowed raw 8-bit data to be included in message bodies sent over SMTP.
|
|
8
|
-
This allowed the message *contents* to contain 8-bit data, including things like UTF-8 text, even though the SMTP protocol itself was still firmly 7-bit. This worked by having the server switch to 8-bit after the headers, and then back to 7-bit after the completion of a `DATA` command.
|
|
9
|
-
|
|
10
|
-
From 1996, messages could support [RFC 2047 encoding](https://www.rfc-editor.org/rfc/rfc2047), which permitted inserting characters from any character set into header *values* (but not names), but only by encoding them in somewhat unreadable ways to allow them to survive passage through a 7-bit channel. An example with a subject of "Schrödinger's cat" would be:
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
Subject: =?utf-8?Q=Schr=C3=B6dinger=92s_Cat?=
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Here the accented `ö` is encoded as `=C3=B6`, which is the UTF-8 encoding of the 2-byte character, and the whole thing is wrapped in `=?utf-8?Q?` to indicate that it uses the UTF-8 charset and `quoted-printable` encoding. This is a bit of a hack, and not very human-friendly, but it works.
|
|
17
|
-
|
|
18
|
-
Similarly, 8-bit message bodies could be encoded using the same `quoted-printable` and `base64` content transfer encoding (CTE) schemes, which preserved the 8-bit content while encoding it in a format that could survive transmission through a 7-bit channel.
|
|
19
|
-
|
|
20
|
-
Domain names were originally also stuck in a 7-bit world, actually even more constrained to only a subset of the US-ASCII character set. But of course, many people want to have domains in their own language/script. Internationalized domain name (IDN) permitted this, using yet another complex encoding scheme called punycode, defined for domain names in 2003 in [RFC 3492](https://www.rfc-editor.org/rfc/rfc3492). This finally allowed the domain part (after the `@`) of email addresses to contain UTF-8, though it was actually an illusion preserved by email client applications. For example, an address of
|
|
21
|
-
`user@café.example.com` translates to
|
|
22
|
-
`user@xn--caf-dma.example.com` in punycode, rendering it mostly unreadable, but 7-bit friendly, and remaining compatible with email clients that don't know about IDN.
|
|
23
|
-
|
|
24
|
-
The one remaining part of email that could not handle UTF-8 is the local part of email addresses (the part before the `@`).
|
|
25
|
-
|
|
26
|
-
I've only mentioned UTF-8 here, but most of these approaches also allowed other character sets that were popular, such as [the ISO-8859 family](https://en.wikipedia.org/wiki/ISO/IEC_8859). However, UTF-8 solves so many problems that these other character sets are gradually falling out of favour, as UTF-8 can support all languages.
|
|
27
|
-
|
|
28
|
-
This patchwork of overlapping approaches has served us well, but we have to admit that it's a mess.
|
|
29
|
-
|
|
30
|
-
## SMTPUTF8
|
|
31
|
-
|
|
32
|
-
`SMTPUTF8` is another SMTP extension, defined in [RFC 6531](https://www.rfc-editor.org/rfc/rfc6531) in 2012. This essentially solves the whole problem, allowing the entire SMTP conversation — commands, headers, and message bodies — to be sent in raw, unencoded UTF-8.
|
|
33
|
-
|
|
34
|
-
But there's a problem with this approach: adoption. If you send a UTF-8 message to a recipient whose mail server doesn't support this format, the sender has to somehow downgrade the message to make it survive a transition to 7-bit. This is a hard problem to solve, especially since there is no way to make a 7-bit system support UTF-8 in the local parts of addresses. This downgrade problem is what held up the adoption of `SMTPUTF8` in PHPMailer for many years, but in that time the *de facto* approach has become to simply fail in that situation, and tell the recipient it's time they upgraded their mail server 😅.
|
|
35
|
-
|
|
36
|
-
The vast majority of large email providers (gmail, Yahoo, Microsoft, etc), mail servers (postfix, exim, IIS, etc), and mail clients (Apple Mail, Outlook, Thunderbird, etc) now all support SMTPUTF8, so the need for backward compatibility is no longer what it was.
|
|
37
|
-
|
|
38
|
-
## SMTPUTF8 in PHPMailer
|
|
39
|
-
|
|
40
|
-
Several other PHP email libraries have implemented a halfway solution to `SMTPUTF8`, adding only the ability to support UTF-8 in email addresses, not elsewhere in the protocol. I wanted PHPMailer to do it "the right way", and this has taken much longer. PHPMailer now supports UTF-8 everywhere, and does not need to use transfer or header encodings for UTF-8 text when connecting to an `SMTPUTF8`-capable mail server.
|
|
41
|
-
|
|
42
|
-
This support is handled automatically: if you add an email address that requires UTF-8, PHPMailer will use UTF-8 for everything. If not, it will fall back to 7-bit and encode the message as necessary.
|
|
43
|
-
|
|
44
|
-
The one place you will need to be careful is in the selection of the address validator. By default, PHPMailer uses PHP's built-in `filter_var` validator, which does not allow UTF-8 email addresses. When PHPMailer spots that you have submitted a UTF-8 address, but have not altered the default validator, it will automatically switch to using a UTF-8-compatible validator. As soon as you do this, any SMTP connection you make will *require* that the server you connect to supports `SMTPUTF8`. You can select this validator explicitly by setting `PHPMailer::$validator = 'eai'` (an acronym for Email Address Internationalization).
|
|
45
|
-
|
|
46
|
-
### Postfix gotcha
|
|
47
|
-
|
|
48
|
-
Postfix has supported `SMTPUTF8` for a long time, but it has a peculiarity that it does not always advertise that it does so. However, rather surprisingly, if you use UTF-8 in the conversation, it will work anyway.
|
|
1
|
+
# A short history of UTF-8 in email
|
|
2
|
+
|
|
3
|
+
## Background
|
|
4
|
+
|
|
5
|
+
For most of its existence, SMTP has been a 7-bit channel, only supporting US-ASCII characters. This has been a problem for many languages, especially those that use non-Latin scripts, and has led to the development of various workarounds.
|
|
6
|
+
|
|
7
|
+
The first major improvement, introduced in 1994 in [RFC 1652](https://www.rfc-editor.org/rfc/rfc1652) and extended in 2011 in [RFC 6152](https://www.rfc-editor.org/rfc/rfc6152), was the addition of the `8BITMIME` SMTP extension, which allowed raw 8-bit data to be included in message bodies sent over SMTP.
|
|
8
|
+
This allowed the message *contents* to contain 8-bit data, including things like UTF-8 text, even though the SMTP protocol itself was still firmly 7-bit. This worked by having the server switch to 8-bit after the headers, and then back to 7-bit after the completion of a `DATA` command.
|
|
9
|
+
|
|
10
|
+
From 1996, messages could support [RFC 2047 encoding](https://www.rfc-editor.org/rfc/rfc2047), which permitted inserting characters from any character set into header *values* (but not names), but only by encoding them in somewhat unreadable ways to allow them to survive passage through a 7-bit channel. An example with a subject of "Schrödinger's cat" would be:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Subject: =?utf-8?Q=Schr=C3=B6dinger=92s_Cat?=
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Here the accented `ö` is encoded as `=C3=B6`, which is the UTF-8 encoding of the 2-byte character, and the whole thing is wrapped in `=?utf-8?Q?` to indicate that it uses the UTF-8 charset and `quoted-printable` encoding. This is a bit of a hack, and not very human-friendly, but it works.
|
|
17
|
+
|
|
18
|
+
Similarly, 8-bit message bodies could be encoded using the same `quoted-printable` and `base64` content transfer encoding (CTE) schemes, which preserved the 8-bit content while encoding it in a format that could survive transmission through a 7-bit channel.
|
|
19
|
+
|
|
20
|
+
Domain names were originally also stuck in a 7-bit world, actually even more constrained to only a subset of the US-ASCII character set. But of course, many people want to have domains in their own language/script. Internationalized domain name (IDN) permitted this, using yet another complex encoding scheme called punycode, defined for domain names in 2003 in [RFC 3492](https://www.rfc-editor.org/rfc/rfc3492). This finally allowed the domain part (after the `@`) of email addresses to contain UTF-8, though it was actually an illusion preserved by email client applications. For example, an address of
|
|
21
|
+
`user@café.example.com` translates to
|
|
22
|
+
`user@xn--caf-dma.example.com` in punycode, rendering it mostly unreadable, but 7-bit friendly, and remaining compatible with email clients that don't know about IDN.
|
|
23
|
+
|
|
24
|
+
The one remaining part of email that could not handle UTF-8 is the local part of email addresses (the part before the `@`).
|
|
25
|
+
|
|
26
|
+
I've only mentioned UTF-8 here, but most of these approaches also allowed other character sets that were popular, such as [the ISO-8859 family](https://en.wikipedia.org/wiki/ISO/IEC_8859). However, UTF-8 solves so many problems that these other character sets are gradually falling out of favour, as UTF-8 can support all languages.
|
|
27
|
+
|
|
28
|
+
This patchwork of overlapping approaches has served us well, but we have to admit that it's a mess.
|
|
29
|
+
|
|
30
|
+
## SMTPUTF8
|
|
31
|
+
|
|
32
|
+
`SMTPUTF8` is another SMTP extension, defined in [RFC 6531](https://www.rfc-editor.org/rfc/rfc6531) in 2012. This essentially solves the whole problem, allowing the entire SMTP conversation — commands, headers, and message bodies — to be sent in raw, unencoded UTF-8.
|
|
33
|
+
|
|
34
|
+
But there's a problem with this approach: adoption. If you send a UTF-8 message to a recipient whose mail server doesn't support this format, the sender has to somehow downgrade the message to make it survive a transition to 7-bit. This is a hard problem to solve, especially since there is no way to make a 7-bit system support UTF-8 in the local parts of addresses. This downgrade problem is what held up the adoption of `SMTPUTF8` in PHPMailer for many years, but in that time the *de facto* approach has become to simply fail in that situation, and tell the recipient it's time they upgraded their mail server 😅.
|
|
35
|
+
|
|
36
|
+
The vast majority of large email providers (gmail, Yahoo, Microsoft, etc), mail servers (postfix, exim, IIS, etc), and mail clients (Apple Mail, Outlook, Thunderbird, etc) now all support SMTPUTF8, so the need for backward compatibility is no longer what it was.
|
|
37
|
+
|
|
38
|
+
## SMTPUTF8 in PHPMailer
|
|
39
|
+
|
|
40
|
+
Several other PHP email libraries have implemented a halfway solution to `SMTPUTF8`, adding only the ability to support UTF-8 in email addresses, not elsewhere in the protocol. I wanted PHPMailer to do it "the right way", and this has taken much longer. PHPMailer now supports UTF-8 everywhere, and does not need to use transfer or header encodings for UTF-8 text when connecting to an `SMTPUTF8`-capable mail server.
|
|
41
|
+
|
|
42
|
+
This support is handled automatically: if you add an email address that requires UTF-8, PHPMailer will use UTF-8 for everything. If not, it will fall back to 7-bit and encode the message as necessary.
|
|
43
|
+
|
|
44
|
+
The one place you will need to be careful is in the selection of the address validator. By default, PHPMailer uses PHP's built-in `filter_var` validator, which does not allow UTF-8 email addresses. When PHPMailer spots that you have submitted a UTF-8 address, but have not altered the default validator, it will automatically switch to using a UTF-8-compatible validator. As soon as you do this, any SMTP connection you make will *require* that the server you connect to supports `SMTPUTF8`. You can select this validator explicitly by setting `PHPMailer::$validator = 'eai'` (an acronym for Email Address Internationalization).
|
|
45
|
+
|
|
46
|
+
### Postfix gotcha
|
|
47
|
+
|
|
48
|
+
Postfix has supported `SMTPUTF8` for a long time, but it has a peculiarity that it does not always advertise that it does so. However, rather surprisingly, if you use UTF-8 in the conversation, it will work anyway.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
7.0.2
|
|
1
|
+
7.0.2
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "phpmailer/phpmailer",
|
|
3
|
-
"type": "library",
|
|
4
|
-
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
|
5
|
-
"authors": [
|
|
6
|
-
{
|
|
7
|
-
"name": "Marcus Bointon",
|
|
8
|
-
"email": "phpmailer@synchromedia.co.uk"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "Jim Jagielski",
|
|
12
|
-
"email": "jimjag@gmail.com"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "Andy Prevost",
|
|
16
|
-
"email": "codeworxtech@users.sourceforge.net"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "Brent R. Matzelle"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"funding": [
|
|
23
|
-
{
|
|
24
|
-
"url": "https://github.com/Synchro",
|
|
25
|
-
"type": "github"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"config": {
|
|
29
|
-
"allow-plugins": {
|
|
30
|
-
"dealerdirect/phpcodesniffer-composer-installer": true
|
|
31
|
-
},
|
|
32
|
-
"lock": false
|
|
33
|
-
},
|
|
34
|
-
"require": {
|
|
35
|
-
"php": ">=5.5.0",
|
|
36
|
-
"ext-ctype": "*",
|
|
37
|
-
"ext-filter": "*",
|
|
38
|
-
"ext-hash": "*"
|
|
39
|
-
},
|
|
40
|
-
"require-dev": {
|
|
41
|
-
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
|
42
|
-
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
|
43
|
-
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
|
44
|
-
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
|
45
|
-
"phpcompatibility/php-compatibility": "^10.0.0@dev",
|
|
46
|
-
"squizlabs/php_codesniffer": "^3.13.5",
|
|
47
|
-
"yoast/phpunit-polyfills": "^1.0.4"
|
|
48
|
-
},
|
|
49
|
-
"suggest": {
|
|
50
|
-
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
|
51
|
-
"ext-imap": "Needed to support advanced email address parsing according to RFC822",
|
|
52
|
-
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
|
53
|
-
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
|
54
|
-
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
|
55
|
-
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
|
56
|
-
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
|
57
|
-
"psr/log": "For optional PSR-3 debug logging",
|
|
58
|
-
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
|
|
59
|
-
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
|
|
60
|
-
"directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example"
|
|
61
|
-
},
|
|
62
|
-
"minimum-stability": "dev",
|
|
63
|
-
"prefer-stable": true,
|
|
64
|
-
"autoload": {
|
|
65
|
-
"psr-4": {
|
|
66
|
-
"PHPMailer\\PHPMailer\\": "src/"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"autoload-dev": {
|
|
70
|
-
"psr-4": {
|
|
71
|
-
"PHPMailer\\Test\\": "test/"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"license": "LGPL-2.1-only",
|
|
75
|
-
"scripts": {
|
|
76
|
-
"check": "./vendor/bin/phpcs",
|
|
77
|
-
"style": "./vendor/bin/phpcbf",
|
|
78
|
-
"test": "./vendor/bin/phpunit --no-coverage",
|
|
79
|
-
"coverage": "./vendor/bin/phpunit",
|
|
80
|
-
"lint": [
|
|
81
|
-
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "phpmailer/phpmailer",
|
|
3
|
+
"type": "library",
|
|
4
|
+
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
|
5
|
+
"authors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Marcus Bointon",
|
|
8
|
+
"email": "phpmailer@synchromedia.co.uk"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Jim Jagielski",
|
|
12
|
+
"email": "jimjag@gmail.com"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Andy Prevost",
|
|
16
|
+
"email": "codeworxtech@users.sourceforge.net"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Brent R. Matzelle"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"funding": [
|
|
23
|
+
{
|
|
24
|
+
"url": "https://github.com/Synchro",
|
|
25
|
+
"type": "github"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"config": {
|
|
29
|
+
"allow-plugins": {
|
|
30
|
+
"dealerdirect/phpcodesniffer-composer-installer": true
|
|
31
|
+
},
|
|
32
|
+
"lock": false
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"php": ">=5.5.0",
|
|
36
|
+
"ext-ctype": "*",
|
|
37
|
+
"ext-filter": "*",
|
|
38
|
+
"ext-hash": "*"
|
|
39
|
+
},
|
|
40
|
+
"require-dev": {
|
|
41
|
+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
|
42
|
+
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
|
43
|
+
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
|
44
|
+
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
|
45
|
+
"phpcompatibility/php-compatibility": "^10.0.0@dev",
|
|
46
|
+
"squizlabs/php_codesniffer": "^3.13.5",
|
|
47
|
+
"yoast/phpunit-polyfills": "^1.0.4"
|
|
48
|
+
},
|
|
49
|
+
"suggest": {
|
|
50
|
+
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
|
51
|
+
"ext-imap": "Needed to support advanced email address parsing according to RFC822",
|
|
52
|
+
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
|
53
|
+
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
|
54
|
+
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
|
55
|
+
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
|
56
|
+
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
|
57
|
+
"psr/log": "For optional PSR-3 debug logging",
|
|
58
|
+
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
|
|
59
|
+
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
|
|
60
|
+
"directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example"
|
|
61
|
+
},
|
|
62
|
+
"minimum-stability": "dev",
|
|
63
|
+
"prefer-stable": true,
|
|
64
|
+
"autoload": {
|
|
65
|
+
"psr-4": {
|
|
66
|
+
"PHPMailer\\PHPMailer\\": "src/"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"autoload-dev": {
|
|
70
|
+
"psr-4": {
|
|
71
|
+
"PHPMailer\\Test\\": "test/"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"license": "LGPL-2.1-only",
|
|
75
|
+
"scripts": {
|
|
76
|
+
"check": "./vendor/bin/phpcs",
|
|
77
|
+
"style": "./vendor/bin/phpcbf",
|
|
78
|
+
"test": "./vendor/bin/phpunit --no-coverage",
|
|
79
|
+
"coverage": "./vendor/bin/phpunit",
|
|
80
|
+
"lint": [
|
|
81
|
+
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* PHPMailer - PHP email creation and transport class.
|
|
5
|
-
* PHP Version 5.5
|
|
6
|
-
* @package PHPMailer
|
|
7
|
-
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
|
8
|
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
|
9
|
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
|
10
|
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
|
11
|
-
* @author Brent R. Matzelle (original founder)
|
|
12
|
-
* @copyright 2012 - 2020 Marcus Bointon
|
|
13
|
-
* @copyright 2010 - 2012 Jim Jagielski
|
|
14
|
-
* @copyright 2004 - 2009 Andy Prevost
|
|
15
|
-
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
|
|
16
|
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
|
17
|
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get an OAuth2 token from an OAuth2 provider.
|
|
23
|
-
* * Install this script on your server so that it's accessible
|
|
24
|
-
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
|
25
|
-
* e.g.: http://localhost/phpmailer/get_oauth_token.php
|
|
26
|
-
* * Ensure dependencies are installed with 'composer install'
|
|
27
|
-
* * Set up an app in your Google/Yahoo/Microsoft account
|
|
28
|
-
* * Set the script address as the app's redirect URL
|
|
29
|
-
* If no refresh token is obtained when running this file,
|
|
30
|
-
* revoke access to your app and run the script again.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
namespace PHPMailer\PHPMailer;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Aliases for League Provider Classes
|
|
37
|
-
* Make sure you have added these to your composer.json and run `composer install`
|
|
38
|
-
* Plenty to choose from here:
|
|
39
|
-
* @see https://oauth2-client.thephpleague.com/providers/thirdparty/
|
|
40
|
-
*/
|
|
41
|
-
//@see https://github.com/thephpleague/oauth2-google
|
|
42
|
-
use League\OAuth2\Client\Provider\Google;
|
|
43
|
-
//@see https://packagist.org/packages/hayageek/oauth2-yahoo
|
|
44
|
-
use Hayageek\OAuth2\Client\Provider\Yahoo;
|
|
45
|
-
//@see https://github.com/stevenmaguire/oauth2-microsoft
|
|
46
|
-
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
|
|
47
|
-
//@see https://github.com/greew/oauth2-azure-provider
|
|
48
|
-
use Greew\OAuth2\Client\Provider\Azure;
|
|
49
|
-
|
|
50
|
-
if (!isset($_GET['code']) && !isset($_POST['provider'])) {
|
|
51
|
-
?>
|
|
52
|
-
<html>
|
|
53
|
-
<body>
|
|
54
|
-
<form method="post">
|
|
55
|
-
<h1>Select Provider</h1>
|
|
56
|
-
<input type="radio" name="provider" value="Google" id="providerGoogle">
|
|
57
|
-
<label for="providerGoogle">Google</label><br>
|
|
58
|
-
<input type="radio" name="provider" value="Yahoo" id="providerYahoo">
|
|
59
|
-
<label for="providerYahoo">Yahoo</label><br>
|
|
60
|
-
<input type="radio" name="provider" value="Microsoft" id="providerMicrosoft">
|
|
61
|
-
<label for="providerMicrosoft">Microsoft</label><br>
|
|
62
|
-
<input type="radio" name="provider" value="Azure" id="providerAzure">
|
|
63
|
-
<label for="providerAzure">Azure</label><br>
|
|
64
|
-
<h1>Enter id and secret</h1>
|
|
65
|
-
<p>These details are obtained by setting up an app in your provider's developer console.
|
|
66
|
-
</p>
|
|
67
|
-
<p>ClientId: <input type="text" name="clientId"><p>
|
|
68
|
-
<p>ClientSecret: <input type="text" name="clientSecret"></p>
|
|
69
|
-
<p>TenantID (only relevant for Azure): <input type="text" name="tenantId"></p>
|
|
70
|
-
<input type="submit" value="Continue">
|
|
71
|
-
</form>
|
|
72
|
-
</body>
|
|
73
|
-
</html>
|
|
74
|
-
<?php
|
|
75
|
-
exit;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
require 'vendor/autoload.php';
|
|
79
|
-
|
|
80
|
-
session_start();
|
|
81
|
-
|
|
82
|
-
$providerName = '';
|
|
83
|
-
$clientId = '';
|
|
84
|
-
$clientSecret = '';
|
|
85
|
-
$tenantId = '';
|
|
86
|
-
|
|
87
|
-
if (array_key_exists('provider', $_POST)) {
|
|
88
|
-
$providerName = $_POST['provider'];
|
|
89
|
-
$clientId = $_POST['clientId'];
|
|
90
|
-
$clientSecret = $_POST['clientSecret'];
|
|
91
|
-
$tenantId = $_POST['tenantId'];
|
|
92
|
-
$_SESSION['provider'] = $providerName;
|
|
93
|
-
$_SESSION['clientId'] = $clientId;
|
|
94
|
-
$_SESSION['clientSecret'] = $clientSecret;
|
|
95
|
-
$_SESSION['tenantId'] = $tenantId;
|
|
96
|
-
} elseif (array_key_exists('provider', $_SESSION)) {
|
|
97
|
-
$providerName = $_SESSION['provider'];
|
|
98
|
-
$clientId = $_SESSION['clientId'];
|
|
99
|
-
$clientSecret = $_SESSION['clientSecret'];
|
|
100
|
-
$tenantId = $_SESSION['tenantId'];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//If you don't want to use the built-in form, set your client id and secret here
|
|
104
|
-
//$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
|
|
105
|
-
//$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
|
|
106
|
-
|
|
107
|
-
//If this automatic URL doesn't work, set it yourself manually to the URL of this script
|
|
108
|
-
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
|
109
|
-
//$redirectUri = 'http://localhost/PHPMailer/redirect';
|
|
110
|
-
|
|
111
|
-
$params = [
|
|
112
|
-
'clientId' => $clientId,
|
|
113
|
-
'clientSecret' => $clientSecret,
|
|
114
|
-
'redirectUri' => $redirectUri,
|
|
115
|
-
'accessType' => 'offline'
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
$options = [];
|
|
119
|
-
$provider = null;
|
|
120
|
-
|
|
121
|
-
switch ($providerName) {
|
|
122
|
-
case 'Google':
|
|
123
|
-
$provider = new Google($params);
|
|
124
|
-
$options = [
|
|
125
|
-
'scope' => [
|
|
126
|
-
'https://mail.google.com/'
|
|
127
|
-
]
|
|
128
|
-
];
|
|
129
|
-
break;
|
|
130
|
-
case 'Yahoo':
|
|
131
|
-
$provider = new Yahoo($params);
|
|
132
|
-
break;
|
|
133
|
-
case 'Microsoft':
|
|
134
|
-
$provider = new Microsoft($params);
|
|
135
|
-
$options = [
|
|
136
|
-
'scope' => [
|
|
137
|
-
'wl.imap',
|
|
138
|
-
'wl.offline_access'
|
|
139
|
-
]
|
|
140
|
-
];
|
|
141
|
-
break;
|
|
142
|
-
case 'Azure':
|
|
143
|
-
$params['tenantId'] = $tenantId;
|
|
144
|
-
|
|
145
|
-
$provider = new Azure($params);
|
|
146
|
-
$options = [
|
|
147
|
-
'scope' => [
|
|
148
|
-
'https://outlook.office.com/SMTP.Send',
|
|
149
|
-
'offline_access'
|
|
150
|
-
]
|
|
151
|
-
];
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (null === $provider) {
|
|
156
|
-
exit('Provider missing');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (!isset($_GET['code'])) {
|
|
160
|
-
//If we don't have an authorization code then get one
|
|
161
|
-
$authUrl = $provider->getAuthorizationUrl($options);
|
|
162
|
-
$_SESSION['oauth2state'] = $provider->getState();
|
|
163
|
-
header('Location: ' . $authUrl);
|
|
164
|
-
exit;
|
|
165
|
-
//Check given state against previously stored one to mitigate CSRF attack
|
|
166
|
-
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
|
167
|
-
unset($_SESSION['oauth2state']);
|
|
168
|
-
unset($_SESSION['provider']);
|
|
169
|
-
exit('Invalid state');
|
|
170
|
-
} else {
|
|
171
|
-
unset($_SESSION['provider']);
|
|
172
|
-
//Try to get an access token (using the authorization code grant)
|
|
173
|
-
$token = $provider->getAccessToken(
|
|
174
|
-
'authorization_code',
|
|
175
|
-
[
|
|
176
|
-
'code' => $_GET['code']
|
|
177
|
-
]
|
|
178
|
-
);
|
|
179
|
-
//Use this to interact with an API on the users behalf
|
|
180
|
-
//Use this to get a new access token if the old one expires
|
|
181
|
-
echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken(), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
|
|
182
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PHPMailer - PHP email creation and transport class.
|
|
5
|
+
* PHP Version 5.5
|
|
6
|
+
* @package PHPMailer
|
|
7
|
+
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
|
8
|
+
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
|
9
|
+
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
|
10
|
+
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
|
11
|
+
* @author Brent R. Matzelle (original founder)
|
|
12
|
+
* @copyright 2012 - 2020 Marcus Bointon
|
|
13
|
+
* @copyright 2010 - 2012 Jim Jagielski
|
|
14
|
+
* @copyright 2004 - 2009 Andy Prevost
|
|
15
|
+
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
|
|
16
|
+
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
|
17
|
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get an OAuth2 token from an OAuth2 provider.
|
|
23
|
+
* * Install this script on your server so that it's accessible
|
|
24
|
+
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
|
25
|
+
* e.g.: http://localhost/phpmailer/get_oauth_token.php
|
|
26
|
+
* * Ensure dependencies are installed with 'composer install'
|
|
27
|
+
* * Set up an app in your Google/Yahoo/Microsoft account
|
|
28
|
+
* * Set the script address as the app's redirect URL
|
|
29
|
+
* If no refresh token is obtained when running this file,
|
|
30
|
+
* revoke access to your app and run the script again.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
namespace PHPMailer\PHPMailer;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Aliases for League Provider Classes
|
|
37
|
+
* Make sure you have added these to your composer.json and run `composer install`
|
|
38
|
+
* Plenty to choose from here:
|
|
39
|
+
* @see https://oauth2-client.thephpleague.com/providers/thirdparty/
|
|
40
|
+
*/
|
|
41
|
+
//@see https://github.com/thephpleague/oauth2-google
|
|
42
|
+
use League\OAuth2\Client\Provider\Google;
|
|
43
|
+
//@see https://packagist.org/packages/hayageek/oauth2-yahoo
|
|
44
|
+
use Hayageek\OAuth2\Client\Provider\Yahoo;
|
|
45
|
+
//@see https://github.com/stevenmaguire/oauth2-microsoft
|
|
46
|
+
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
|
|
47
|
+
//@see https://github.com/greew/oauth2-azure-provider
|
|
48
|
+
use Greew\OAuth2\Client\Provider\Azure;
|
|
49
|
+
|
|
50
|
+
if (!isset($_GET['code']) && !isset($_POST['provider'])) {
|
|
51
|
+
?>
|
|
52
|
+
<html>
|
|
53
|
+
<body>
|
|
54
|
+
<form method="post">
|
|
55
|
+
<h1>Select Provider</h1>
|
|
56
|
+
<input type="radio" name="provider" value="Google" id="providerGoogle">
|
|
57
|
+
<label for="providerGoogle">Google</label><br>
|
|
58
|
+
<input type="radio" name="provider" value="Yahoo" id="providerYahoo">
|
|
59
|
+
<label for="providerYahoo">Yahoo</label><br>
|
|
60
|
+
<input type="radio" name="provider" value="Microsoft" id="providerMicrosoft">
|
|
61
|
+
<label for="providerMicrosoft">Microsoft</label><br>
|
|
62
|
+
<input type="radio" name="provider" value="Azure" id="providerAzure">
|
|
63
|
+
<label for="providerAzure">Azure</label><br>
|
|
64
|
+
<h1>Enter id and secret</h1>
|
|
65
|
+
<p>These details are obtained by setting up an app in your provider's developer console.
|
|
66
|
+
</p>
|
|
67
|
+
<p>ClientId: <input type="text" name="clientId"><p>
|
|
68
|
+
<p>ClientSecret: <input type="text" name="clientSecret"></p>
|
|
69
|
+
<p>TenantID (only relevant for Azure): <input type="text" name="tenantId"></p>
|
|
70
|
+
<input type="submit" value="Continue">
|
|
71
|
+
</form>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
74
|
+
<?php
|
|
75
|
+
exit;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
require 'vendor/autoload.php';
|
|
79
|
+
|
|
80
|
+
session_start();
|
|
81
|
+
|
|
82
|
+
$providerName = '';
|
|
83
|
+
$clientId = '';
|
|
84
|
+
$clientSecret = '';
|
|
85
|
+
$tenantId = '';
|
|
86
|
+
|
|
87
|
+
if (array_key_exists('provider', $_POST)) {
|
|
88
|
+
$providerName = $_POST['provider'];
|
|
89
|
+
$clientId = $_POST['clientId'];
|
|
90
|
+
$clientSecret = $_POST['clientSecret'];
|
|
91
|
+
$tenantId = $_POST['tenantId'];
|
|
92
|
+
$_SESSION['provider'] = $providerName;
|
|
93
|
+
$_SESSION['clientId'] = $clientId;
|
|
94
|
+
$_SESSION['clientSecret'] = $clientSecret;
|
|
95
|
+
$_SESSION['tenantId'] = $tenantId;
|
|
96
|
+
} elseif (array_key_exists('provider', $_SESSION)) {
|
|
97
|
+
$providerName = $_SESSION['provider'];
|
|
98
|
+
$clientId = $_SESSION['clientId'];
|
|
99
|
+
$clientSecret = $_SESSION['clientSecret'];
|
|
100
|
+
$tenantId = $_SESSION['tenantId'];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//If you don't want to use the built-in form, set your client id and secret here
|
|
104
|
+
//$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
|
|
105
|
+
//$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
|
|
106
|
+
|
|
107
|
+
//If this automatic URL doesn't work, set it yourself manually to the URL of this script
|
|
108
|
+
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
|
109
|
+
//$redirectUri = 'http://localhost/PHPMailer/redirect';
|
|
110
|
+
|
|
111
|
+
$params = [
|
|
112
|
+
'clientId' => $clientId,
|
|
113
|
+
'clientSecret' => $clientSecret,
|
|
114
|
+
'redirectUri' => $redirectUri,
|
|
115
|
+
'accessType' => 'offline'
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
$options = [];
|
|
119
|
+
$provider = null;
|
|
120
|
+
|
|
121
|
+
switch ($providerName) {
|
|
122
|
+
case 'Google':
|
|
123
|
+
$provider = new Google($params);
|
|
124
|
+
$options = [
|
|
125
|
+
'scope' => [
|
|
126
|
+
'https://mail.google.com/'
|
|
127
|
+
]
|
|
128
|
+
];
|
|
129
|
+
break;
|
|
130
|
+
case 'Yahoo':
|
|
131
|
+
$provider = new Yahoo($params);
|
|
132
|
+
break;
|
|
133
|
+
case 'Microsoft':
|
|
134
|
+
$provider = new Microsoft($params);
|
|
135
|
+
$options = [
|
|
136
|
+
'scope' => [
|
|
137
|
+
'wl.imap',
|
|
138
|
+
'wl.offline_access'
|
|
139
|
+
]
|
|
140
|
+
];
|
|
141
|
+
break;
|
|
142
|
+
case 'Azure':
|
|
143
|
+
$params['tenantId'] = $tenantId;
|
|
144
|
+
|
|
145
|
+
$provider = new Azure($params);
|
|
146
|
+
$options = [
|
|
147
|
+
'scope' => [
|
|
148
|
+
'https://outlook.office.com/SMTP.Send',
|
|
149
|
+
'offline_access'
|
|
150
|
+
]
|
|
151
|
+
];
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (null === $provider) {
|
|
156
|
+
exit('Provider missing');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!isset($_GET['code'])) {
|
|
160
|
+
//If we don't have an authorization code then get one
|
|
161
|
+
$authUrl = $provider->getAuthorizationUrl($options);
|
|
162
|
+
$_SESSION['oauth2state'] = $provider->getState();
|
|
163
|
+
header('Location: ' . $authUrl);
|
|
164
|
+
exit;
|
|
165
|
+
//Check given state against previously stored one to mitigate CSRF attack
|
|
166
|
+
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
|
167
|
+
unset($_SESSION['oauth2state']);
|
|
168
|
+
unset($_SESSION['provider']);
|
|
169
|
+
exit('Invalid state');
|
|
170
|
+
} else {
|
|
171
|
+
unset($_SESSION['provider']);
|
|
172
|
+
//Try to get an access token (using the authorization code grant)
|
|
173
|
+
$token = $provider->getAccessToken(
|
|
174
|
+
'authorization_code',
|
|
175
|
+
[
|
|
176
|
+
'code' => $_GET['code']
|
|
177
|
+
]
|
|
178
|
+
);
|
|
179
|
+
//Use this to interact with an API on the users behalf
|
|
180
|
+
//Use this to get a new access token if the old one expires
|
|
181
|
+
echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken(), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
|
|
182
|
+
}
|