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,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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# PHPMailer Documentation
|
|
2
|
+
|
|
3
|
+
Generated documentation for PHPMailer is [available online](https://phpmailer.github.io/PHPMailer/), and is regenerated automatically whenever changes are made.
|
|
4
|
+
|
|
5
|
+
Pre-built PHPMailer API documentation is not provided in this repo, but you can generate it by running `phpdoc` in the top-level folder of this project, and documentation will be generated in this `docs` folder. You will need to have [phpDocumentor](https://www.phpdoc.org) installed. The configuration for phpdoc is in the [phpdoc.dist.xml file](https://github.com/PHPMailer/PHPMailer/blob/master/phpdoc.dist.xml).
|
|
6
|
+
|
|
7
|
+
Further help and information is available in [the PHPMailer README](https://github.com/PHPMailer/PHPMailer/blob/master/README.md), [the examples folder](https://github.com/PHPMailer/PHPMailer/tree/master/examples), and in [the GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki).
|
|
8
|
+
|
|
9
|
+
Fixes and additions to documentation are welcome - please submit pull requests or improve wiki pages.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This shows how to make a new public/private key pair suitable for use with DKIM.
|
|
5
|
+
* You should only need to do this once, and the public key (**not** the private key!)
|
|
6
|
+
* you generate should be inserted in your DNS matching the selector you want.
|
|
7
|
+
*
|
|
8
|
+
* You can also use the DKIM wizard here: https://www.sparkpost.com/resources/tools/dkim-wizard/
|
|
9
|
+
* but be aware that having your private key known anywhere outside your own server
|
|
10
|
+
* is a security risk, and it's easy enough to create your own on your own server.
|
|
11
|
+
*
|
|
12
|
+
* For security, any keys you create should not be accessible via your web site.
|
|
13
|
+
*
|
|
14
|
+
* 2048 bits is the recommended minimum key length - gmail won't accept less than 1024 bits.
|
|
15
|
+
* To test your DKIM config, use Sparkpost's DKIM tester:
|
|
16
|
+
* https://tools.sparkpost.com/dkim
|
|
17
|
+
*
|
|
18
|
+
* Note that you only need a *private* key to *send* a DKIM-signed message,
|
|
19
|
+
* but receivers need your *public* key in order to verify it.
|
|
20
|
+
*
|
|
21
|
+
* Your public key will need to be formatted appropriately for your DNS and
|
|
22
|
+
* inserted there using the selector you want to use.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
//Set these to match your domain and chosen DKIM selector
|
|
26
|
+
$domain = 'example.com';
|
|
27
|
+
$selector = 'phpmailer';
|
|
28
|
+
|
|
29
|
+
//Private key filename for this selector
|
|
30
|
+
$privatekeyfile = $selector . '_dkim_private.pem';
|
|
31
|
+
//Public key filename for this selector
|
|
32
|
+
$publickeyfile = $selector . '_dkim_public.pem';
|
|
33
|
+
|
|
34
|
+
if (file_exists($privatekeyfile)) {
|
|
35
|
+
echo "Using existing keys - if you want to generate new keys, delete old key files first.\n\n";
|
|
36
|
+
$privatekey = file_get_contents($privatekeyfile);
|
|
37
|
+
$publickey = file_get_contents($publickeyfile);
|
|
38
|
+
} else {
|
|
39
|
+
//Create a 2048-bit RSA key with an SHA256 digest
|
|
40
|
+
$pk = openssl_pkey_new(
|
|
41
|
+
[
|
|
42
|
+
'digest_alg' => 'sha256',
|
|
43
|
+
'private_key_bits' => 2048,
|
|
44
|
+
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
|
45
|
+
]
|
|
46
|
+
);
|
|
47
|
+
//Save private key
|
|
48
|
+
openssl_pkey_export_to_file($pk, $privatekeyfile);
|
|
49
|
+
//Save public key
|
|
50
|
+
$pubKey = openssl_pkey_get_details($pk);
|
|
51
|
+
$publickey = $pubKey['key'];
|
|
52
|
+
file_put_contents($publickeyfile, $publickey);
|
|
53
|
+
$privatekey = file_get_contents($privatekeyfile);
|
|
54
|
+
}
|
|
55
|
+
echo "Private key (keep this private!):\n\n" . $privatekey;
|
|
56
|
+
echo "\n\nPublic key:\n\n" . $publickey;
|
|
57
|
+
|
|
58
|
+
//Prepare public key for DNS, e.g.
|
|
59
|
+
//phpmailer._domainkey.example.com IN TXT "v=DKIM1; h=sha256; t=s; p=" "MIIBIjANBg...oXlwIDAQAB"...
|
|
60
|
+
$dnskey = "$selector._domainkey.$domain IN TXT";
|
|
61
|
+
$dnsvalue = '"v=DKIM1; h=sha256; t=s; p=" ';
|
|
62
|
+
//Some DNS servers don't like ;(semi colon) chars unless backslash-escaped
|
|
63
|
+
$dnsvalue2 = '"v=DKIM1\; h=sha256\; t=s\; p=" ';
|
|
64
|
+
|
|
65
|
+
//Strip and split the key into smaller parts and format for DNS
|
|
66
|
+
//Many DNS systems don't like long TXT entries
|
|
67
|
+
//but are OK if it's split into 255-char chunks
|
|
68
|
+
//Remove PEM wrapper
|
|
69
|
+
$publickey = preg_replace('/^-+.*?-+$/m', '', $publickey);
|
|
70
|
+
//Strip line breaks
|
|
71
|
+
$publickey = str_replace(["\r", "\n"], '', $publickey);
|
|
72
|
+
//Split into chunks
|
|
73
|
+
$keyparts = str_split($publickey, 253); //Becomes 255 when quotes are included
|
|
74
|
+
//Quote each chunk
|
|
75
|
+
foreach ($keyparts as $keypart) {
|
|
76
|
+
$dnsvalue .= '"' . trim($keypart) . '" ';
|
|
77
|
+
$dnsvalue2 .= '"' . trim($keypart) . '" ';
|
|
78
|
+
}
|
|
79
|
+
echo "\n\nDNS key:\n\n" . trim($dnskey);
|
|
80
|
+
echo "\n\nDNS value:\n\n" . trim($dnsvalue);
|
|
81
|
+
echo "\n\nDNS value (with escaping):\n\n" . trim($dnsvalue2);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This example shows sending a DKIM-signed message with PHPMailer.
|
|
5
|
+
* More info about DKIM can be found here: https://www.dkim.org/info/dkim-faq.html
|
|
6
|
+
* There's more to using DKIM than just this code - check out this article:
|
|
7
|
+
* @see https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
|
|
8
|
+
* See also the DKIM_gen_keys example code in the examples folder,
|
|
9
|
+
* which shows how to make a key pair from PHP.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
//Import the PHPMailer class into the global namespace
|
|
13
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
14
|
+
|
|
15
|
+
require '../vendor/autoload.php';
|
|
16
|
+
|
|
17
|
+
//Usual setup
|
|
18
|
+
$mail = new PHPMailer();
|
|
19
|
+
$mail->setFrom('from@example.com', 'First Last');
|
|
20
|
+
$mail->addAddress('whoto@example.com', 'John Doe');
|
|
21
|
+
$mail->Subject = 'PHPMailer mail() test';
|
|
22
|
+
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
|
|
23
|
+
|
|
24
|
+
//This should be the same as the domain of your From address
|
|
25
|
+
$mail->DKIM_domain = 'example.com';
|
|
26
|
+
//See the DKIM_gen_keys.phps script for making a key pair -
|
|
27
|
+
//here we assume you've already done that.
|
|
28
|
+
//Path to your private key:
|
|
29
|
+
$mail->DKIM_private = 'dkim_private.pem';
|
|
30
|
+
//Set this to your own selector
|
|
31
|
+
$mail->DKIM_selector = 'phpmailer';
|
|
32
|
+
//Put your private key's passphrase in here if it has one
|
|
33
|
+
$mail->DKIM_passphrase = '';
|
|
34
|
+
//The identity you're signing as - usually your From address
|
|
35
|
+
$mail->DKIM_identity = $mail->From;
|
|
36
|
+
//Suppress listing signed header fields in signature, defaults to true for debugging purpose
|
|
37
|
+
$mail->DKIM_copyHeaderFields = false;
|
|
38
|
+
//Optionally you can add extra headers for signing to meet special requirements
|
|
39
|
+
$mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Help'];
|
|
40
|
+
|
|
41
|
+
//When you send, the DKIM settings will be used to sign the message
|
|
42
|
+
if (!$mail->send()) {
|
|
43
|
+
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
|
44
|
+
} else {
|
|
45
|
+
echo 'Message sent!';
|
|
46
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[](https://github.com/PHPMailer/PHPMailer)
|
|
2
|
+
# PHPMailer code examples
|
|
3
|
+
|
|
4
|
+
This folder contains a collection of examples of using [PHPMailer](https://github.com/PHPMailer/PHPMailer).
|
|
5
|
+
|
|
6
|
+
## About testing email sending
|
|
7
|
+
|
|
8
|
+
When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:
|
|
9
|
+
|
|
10
|
+
* [FakeEmail](https://github.com/tomwardill/FakeEmail), a Python-based fake mail server with a web interface.
|
|
11
|
+
* [smtp-sink](https://www.postfix.org/smtp-sink.1.html), part of the Postfix mail server, so you may have this installed already. This is used in the GitHub actions configuration to run PHPMailer's unit tests.
|
|
12
|
+
* [smtp4dev](https://github.com/rnwood/smtp4dev), a dummy SMTP server for Windows and Linux.
|
|
13
|
+
* [fakesendmail.sh](https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh), part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.
|
|
14
|
+
* [HELO](https://usehelo.com), a very nice (commercial) mail server desktop app from BeyondCode, and [how to set it up for local testing](https://usehelo.com/blog/how-to-use-helo-with-phps-mail-function).
|
|
15
|
+
* [msglint](https://www.splitbrain.org/_static/msglint/), not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.
|
|
16
|
+
* [MailHog](https://github.com/les-enovateurs/mailhog-examples), a Go-based email testing tool for developers with a web interface. You can use it with Docker and GitHub Actions to test your mails. The repository also contains a small part of PHPMailer's setup.
|
|
17
|
+
* [aboutmy.email](https://aboutmy.email), a service for evaluating your email config – SPF, DKIM, DMARC, and compliance with list-unsubscribe, TLS, and many other settings.
|
|
18
|
+
|
|
19
|
+
Most of these examples use the `example.com` and `example.net` domains. These domains are reserved by IANA for illustrative purposes, as documented in [RFC 2606](https://www.rfc-editor.org/rfc/rfc2606). Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!
|
|
20
|
+
|
|
21
|
+
## Security note
|
|
22
|
+
Before running these examples in a web server, you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - _please don't do that!_
|
|
23
|
+
|
|
24
|
+
Similarly, don't leave your passwords in these files as they will be visible to the world!
|
|
25
|
+
|
|
26
|
+
## [mail.phps](mail.phps)
|
|
27
|
+
|
|
28
|
+
This is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.
|
|
29
|
+
|
|
30
|
+
## [simple_contact_form.phps](simple_contact_form.phps)
|
|
31
|
+
|
|
32
|
+
This is probably the most common reason for using PHPMailer - building a contact form. This example has a basic, unstyled form and also illustrates how to filter input data before using it, how to validate addresses, how to avoid being abused as a spam gateway, and how to address messages correctly so that you don't fail SPF checks.
|
|
33
|
+
|
|
34
|
+
## [exceptions.phps](exceptions.phps)
|
|
35
|
+
|
|
36
|
+
Like the mail example, but shows how to use PHPMailer's optional exceptions for error handling.
|
|
37
|
+
|
|
38
|
+
## [extending.phps](extending.phps)
|
|
39
|
+
|
|
40
|
+
This shows how to create a subclass of PHPMailer to customise its behaviour and simplify coding in your app.
|
|
41
|
+
|
|
42
|
+
## [smtp.phps](smtp.phps)
|
|
43
|
+
|
|
44
|
+
A simple example sending using SMTP with authentication.
|
|
45
|
+
|
|
46
|
+
## [smtp_no_auth.phps](smtp_no_auth.phps)
|
|
47
|
+
|
|
48
|
+
A simple example sending using SMTP without authentication.
|
|
49
|
+
|
|
50
|
+
## [send_file_upload.phps](send_file_upload.phps)
|
|
51
|
+
|
|
52
|
+
Lots of people want to do this... This is a simple form which accepts a file upload and emails it.
|
|
53
|
+
|
|
54
|
+
## [send_multiple_file_upload.phps](send_multiple_file_upload.phps)
|
|
55
|
+
|
|
56
|
+
A slightly more complex form that allows uploading multiple files at once and sends all of them as attachments to an email.
|
|
57
|
+
|
|
58
|
+
## [sendmail.phps](sendmail.phps)
|
|
59
|
+
|
|
60
|
+
A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.
|
|
61
|
+
|
|
62
|
+
## [gmail.phps](gmail.phps)
|
|
63
|
+
|
|
64
|
+
Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.
|
|
65
|
+
|
|
66
|
+
## [gmail_xoauth.phps](gmail_xoauth.phps)
|
|
67
|
+
|
|
68
|
+
Gmail now likes you to use XOAUTH2 for SMTP authentication. This is extremely laborious to set up, but once it's done you can use it repeatedly and will no longer need Gmail's ineptly-named "Allow less secure apps" setting enabled. [Read the guide in the wiki](https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2) for how to set it up.
|
|
69
|
+
|
|
70
|
+
## [pop_before_smtp.phps](pop_before_smtp.phps)
|
|
71
|
+
|
|
72
|
+
Back in the stone age, before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a basic POP3 protocol client with just enough functionality to carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP3 first.
|
|
73
|
+
|
|
74
|
+
## [mailing_list.phps](mailing_list.phps)
|
|
75
|
+
|
|
76
|
+
This is a somewhat naïve, but reasonably efficient example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.
|
|
77
|
+
|
|
78
|
+
## [ssl_options.phps](ssl_options.phps)
|
|
79
|
+
|
|
80
|
+
PHP 5.6 introduced SSL certificate verification by default, and this applies to mail servers exactly as it does to web servers. Unfortunately, SSL misconfiguration in mail servers is quite common, so this caused a common problem: those that were previously using servers with bad configs suddenly found they stopped working when they upgraded PHP. PHPMailer provides a mechanism to disable SSL certificate verification as a workaround and this example shows how to do it. Bear in mind that this is **not** a good approach - the right way is to fix your mail server config!
|
|
81
|
+
|
|
82
|
+
## [smime_signed_mail.phps](smime_signed_mail.phps)
|
|
83
|
+
|
|
84
|
+
An example of how to sign messages using [S/MIME](https://en.wikipedia.org/wiki/S/MIME), ensuring that your data can't be tampered with in transit, and proves to recipients that it was you that sent it.
|
|
85
|
+
|
|
86
|
+
* * *
|
|
87
|
+
|
|
88
|
+
## [smtp_check.phps](smtp_check.phps)
|
|
89
|
+
|
|
90
|
+
This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.
|
|
91
|
+
|
|
92
|
+
## [smtp_low_memory.phps](smtp_low_memory.phps)
|
|
93
|
+
|
|
94
|
+
This demonstrates how to extend the SMTP class and make PHPMailer use it. In this case it's an effort to make the SMTP class use less memory when sending large attachments.
|
|
95
|
+
|
|
96
|
+
* * *
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This example shows how to send via Microsoft Outlook's servers using XOAUTH2 authentication
|
|
5
|
+
* using the league/oauth2-client to provide the OAuth2 token.
|
|
6
|
+
* To use a different OAuth2 library create a wrapper class that implements OAuthTokenProvider and
|
|
7
|
+
* pass that wrapper class to PHPMailer::setOAuth().
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
//Import PHPMailer classes into the global namespace
|
|
11
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
12
|
+
use PHPMailer\PHPMailer\SMTP;
|
|
13
|
+
use PHPMailer\PHPMailer\OAuth;
|
|
14
|
+
//Alias the League Google OAuth2 provider class
|
|
15
|
+
use Greew\OAuth2\Client\Provider\Azure;
|
|
16
|
+
|
|
17
|
+
//SMTP needs accurate times, and the PHP time zone MUST be set
|
|
18
|
+
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
|
19
|
+
date_default_timezone_set('Etc/UTC');
|
|
20
|
+
|
|
21
|
+
//Load dependencies from composer
|
|
22
|
+
//If this causes an error, run 'composer install'
|
|
23
|
+
require '../vendor/autoload.php';
|
|
24
|
+
|
|
25
|
+
//Create a new PHPMailer instance
|
|
26
|
+
$mail = new PHPMailer();
|
|
27
|
+
|
|
28
|
+
//Tell PHPMailer to use SMTP
|
|
29
|
+
$mail->isSMTP();
|
|
30
|
+
|
|
31
|
+
//Enable SMTP debugging
|
|
32
|
+
//SMTP::DEBUG_OFF = off (for production use)
|
|
33
|
+
//SMTP::DEBUG_CLIENT = client messages
|
|
34
|
+
//SMTP::DEBUG_SERVER = client and server messages
|
|
35
|
+
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
|
|
36
|
+
|
|
37
|
+
//Set the hostname of the mail server
|
|
38
|
+
$mail->Host = 'smtp.office365.com';
|
|
39
|
+
|
|
40
|
+
//Set the SMTP port number:
|
|
41
|
+
// - 465 for SMTP with implicit TLS, a.k.a. RFC8314 SMTPS or
|
|
42
|
+
// - 587 for SMTP+STARTTLS
|
|
43
|
+
$mail->Port = 587;
|
|
44
|
+
|
|
45
|
+
//Set the encryption mechanism to use:
|
|
46
|
+
// - SMTPS (implicit TLS on port 465) or
|
|
47
|
+
// - STARTTLS (explicit TLS on port 587)
|
|
48
|
+
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
|
49
|
+
|
|
50
|
+
//Whether to use SMTP authentication
|
|
51
|
+
$mail->SMTPAuth = true;
|
|
52
|
+
|
|
53
|
+
//Set AuthType to use XOAUTH2
|
|
54
|
+
$mail->AuthType = 'XOAUTH2';
|
|
55
|
+
|
|
56
|
+
//Start Option 1: Use league/oauth2-client as OAuth2 token provider
|
|
57
|
+
//Fill in authentication details here
|
|
58
|
+
//Either the microsoft account owner, or the user that gave consent
|
|
59
|
+
$email = 'someone@somemicrosoftaccount.com';
|
|
60
|
+
$clientId = 'RANDOMCHARS-----duv1n2TS';
|
|
61
|
+
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
|
|
62
|
+
$tenantId = 'RANDOMCHARS-----HSFTAOIlagss';
|
|
63
|
+
|
|
64
|
+
//Obtained by configuring and running get_oauth_token.php
|
|
65
|
+
//after setting up an app in Google Developer Console.
|
|
66
|
+
$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0';
|
|
67
|
+
|
|
68
|
+
//Create a new OAuth2 provider instance
|
|
69
|
+
$provider = new Azure(
|
|
70
|
+
[
|
|
71
|
+
'clientId' => $clientId,
|
|
72
|
+
'clientSecret' => $clientSecret,
|
|
73
|
+
'tenantId' => $tenantId,
|
|
74
|
+
]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
//Pass the OAuth provider instance to PHPMailer
|
|
78
|
+
$mail->setOAuth(
|
|
79
|
+
new OAuth(
|
|
80
|
+
[
|
|
81
|
+
'provider' => $provider,
|
|
82
|
+
'clientId' => $clientId,
|
|
83
|
+
'clientSecret' => $clientSecret,
|
|
84
|
+
'refreshToken' => $refreshToken,
|
|
85
|
+
'userName' => $email,
|
|
86
|
+
]
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
//End Option 1
|
|
90
|
+
|
|
91
|
+
//Option 2: Another OAuth library as OAuth2 token provider
|
|
92
|
+
//Set up the other oauth library as per its documentation
|
|
93
|
+
//Then create the wrapper class that implementations OAuthTokenProvider
|
|
94
|
+
$oauthTokenProvider = new MyOAuthTokenProvider(/* Email, ClientId, ClientSecret, etc. */);
|
|
95
|
+
|
|
96
|
+
//Pass the implementation of OAuthTokenProvider to PHPMailer
|
|
97
|
+
$mail->setOAuth($oauthTokenProvider);
|
|
98
|
+
//End Option 2
|
|
99
|
+
|
|
100
|
+
//Set who the message is to be sent from
|
|
101
|
+
//For Outlook, this generally needs to be the same as the user you logged in as
|
|
102
|
+
$mail->setFrom($email, 'First Last');
|
|
103
|
+
|
|
104
|
+
//Set who the message is to be sent to
|
|
105
|
+
$mail->addAddress('someone@someserver.com', 'John Doe');
|
|
106
|
+
|
|
107
|
+
//Set the subject line
|
|
108
|
+
$mail->Subject = 'PHPMailer Outlook XOAUTH2 SMTP test';
|
|
109
|
+
|
|
110
|
+
//Read an HTML message body from an external file, convert referenced images to embedded,
|
|
111
|
+
//convert HTML into a basic plain-text alternative body
|
|
112
|
+
$mail->CharSet = PHPMailer::CHARSET_UTF8;
|
|
113
|
+
$mail->msgHTML(file_get_contents('contentsutf8.html'), __DIR__);
|
|
114
|
+
|
|
115
|
+
//Replace the plain text body with one created manually
|
|
116
|
+
$mail->AltBody = 'This is a plain-text message body';
|
|
117
|
+
|
|
118
|
+
//Attach an image file
|
|
119
|
+
$mail->addAttachment('images/phpmailer_mini.png');
|
|
120
|
+
|
|
121
|
+
//send the message, check for errors
|
|
122
|
+
if (!$mail->send()) {
|
|
123
|
+
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
|
124
|
+
} else {
|
|
125
|
+
echo 'Message sent!';
|
|
126
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This example shows how to use a callback function from PHPMailer.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
//Import PHPMailer classes into the global namespace
|
|
8
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
9
|
+
use PHPMailer\PHPMailer\Exception;
|
|
10
|
+
|
|
11
|
+
require '../vendor/autoload.php';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Example PHPMailer callback function.
|
|
15
|
+
* This is a global function, but you can also pass a closure (or any other callable)
|
|
16
|
+
* to the `action_function` property.
|
|
17
|
+
*
|
|
18
|
+
* @param bool $result result of the send action
|
|
19
|
+
* @param array $to email address of the recipient
|
|
20
|
+
* @param array $cc cc email addresses
|
|
21
|
+
* @param array $bcc bcc email addresses
|
|
22
|
+
* @param string $subject the subject
|
|
23
|
+
* @param string $body the email body
|
|
24
|
+
*/
|
|
25
|
+
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
|
|
26
|
+
{
|
|
27
|
+
echo "Message subject: \"$subject\"\n";
|
|
28
|
+
foreach ($to as $address) {
|
|
29
|
+
echo "Message to {$address[1]} <{$address[0]}>\n";
|
|
30
|
+
}
|
|
31
|
+
foreach ($cc as $address) {
|
|
32
|
+
echo "Message CC to {$address[1]} <{$address[0]}>\n";
|
|
33
|
+
}
|
|
34
|
+
foreach ($bcc as $toaddress) {
|
|
35
|
+
echo "Message BCC to {$toaddress[1]} <{$toaddress[0]}>\n";
|
|
36
|
+
}
|
|
37
|
+
if ($result) {
|
|
38
|
+
echo "Message sent successfully\n";
|
|
39
|
+
} else {
|
|
40
|
+
echo "Message send failed\n";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
require_once '../vendor/autoload.php';
|
|
45
|
+
|
|
46
|
+
$mail = new PHPMailer();
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
$mail->isMail();
|
|
50
|
+
$mail->setFrom('you@example.com', 'Your Name');
|
|
51
|
+
$mail->addAddress('jane@example.com', 'Jane Doe');
|
|
52
|
+
$mail->addCC('john@example.com', 'John Doe');
|
|
53
|
+
$mail->Subject = 'PHPMailer Test Subject';
|
|
54
|
+
$mail->msgHTML(file_get_contents('../examples/contents.html'));
|
|
55
|
+
//Optional - msgHTML will create an alternate automatically
|
|
56
|
+
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
|
|
57
|
+
$mail->addAttachment('images/phpmailer_mini.png');
|
|
58
|
+
$mail->action_function = 'callbackAction';
|
|
59
|
+
$mail->send();
|
|
60
|
+
} catch (Exception $e) {
|
|
61
|
+
echo $e->errorMessage();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//Alternative approach using a closure
|
|
65
|
+
try {
|
|
66
|
+
$mail->action_function = static function ($result, $to, $cc, $bcc, $subject, $body) {
|
|
67
|
+
if ($result) {
|
|
68
|
+
echo "Message sent successfully\n";
|
|
69
|
+
} else {
|
|
70
|
+
echo "Message send failed\n";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
$mail->send();
|
|
74
|
+
} catch (Exception $e) {
|
|
75
|
+
echo $e->errorMessage();
|
|
76
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This example shows how to handle a simple contact form safely.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
//Import PHPMailer class into the global namespace
|
|
8
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
9
|
+
|
|
10
|
+
//Don't run this unless we're handling a form submission
|
|
11
|
+
if (array_key_exists('email', $_POST)) {
|
|
12
|
+
date_default_timezone_set('Etc/UTC');
|
|
13
|
+
require '../vendor/autoload.php';
|
|
14
|
+
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
|
15
|
+
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
|
|
16
|
+
|
|
17
|
+
//Create a new PHPMailer instance
|
|
18
|
+
$mail = new PHPMailer();
|
|
19
|
+
//Send using SMTP to localhost (faster and safer than using mail()) – requires a local mail server
|
|
20
|
+
//See other examples for how to use a remote server such as gmail
|
|
21
|
+
$mail->isSMTP();
|
|
22
|
+
$mail->Host = 'localhost';
|
|
23
|
+
$mail->Port = 25;
|
|
24
|
+
|
|
25
|
+
//Use a fixed address in your own domain as the from address
|
|
26
|
+
//**DO NOT** use the submitter's address here as it will be forgery
|
|
27
|
+
//and will cause your messages to fail SPF checks
|
|
28
|
+
$mail->setFrom('from@example.com', 'First Last');
|
|
29
|
+
//Choose who the message should be sent to
|
|
30
|
+
//You don't have to use a <select> like in this example, you can simply use a fixed address
|
|
31
|
+
//the important thing is *not* to trust an email address submitted from the form directly,
|
|
32
|
+
//as an attacker can substitute their own and try to use your form to send spam
|
|
33
|
+
$addresses = [
|
|
34
|
+
'sales' => 'sales@example.com',
|
|
35
|
+
'support' => 'support@example.com',
|
|
36
|
+
'accounts' => 'accounts@example.com',
|
|
37
|
+
];
|
|
38
|
+
//Validate address selection before trying to use it
|
|
39
|
+
if (array_key_exists('dept', $_POST) && array_key_exists($_POST['dept'], $addresses)) {
|
|
40
|
+
$mail->addAddress($addresses[$_POST['dept']]);
|
|
41
|
+
} else {
|
|
42
|
+
//Fall back to a fixed address if dept selection is invalid or missing
|
|
43
|
+
$mail->addAddress('support@example.com');
|
|
44
|
+
}
|
|
45
|
+
//Put the submitter's address in a reply-to header
|
|
46
|
+
//This will fail if the address provided is invalid,
|
|
47
|
+
//in which case we should ignore the whole request
|
|
48
|
+
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
|
|
49
|
+
$mail->Subject = 'PHPMailer contact form';
|
|
50
|
+
//Keep it simple - don't use HTML
|
|
51
|
+
$mail->isHTML(false);
|
|
52
|
+
//Build a simple message body
|
|
53
|
+
$mail->Body = <<<EOT
|
|
54
|
+
Email: {$_POST['email']}
|
|
55
|
+
Name: {$_POST['name']}
|
|
56
|
+
Message: {$_POST['message']}
|
|
57
|
+
EOT;
|
|
58
|
+
|
|
59
|
+
//Send the message, check for errors
|
|
60
|
+
if (!$mail->send()) {
|
|
61
|
+
//The reason for failing to send will be in $mail->ErrorInfo
|
|
62
|
+
//but it's unsafe to display errors directly to users - process the error, log it on your server.
|
|
63
|
+
if ($isAjax) {
|
|
64
|
+
http_response_code(500);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
$response = [
|
|
68
|
+
"status" => false,
|
|
69
|
+
"message" => 'Sorry, something went wrong. Please try again later.'
|
|
70
|
+
];
|
|
71
|
+
} else {
|
|
72
|
+
$response = [
|
|
73
|
+
"status" => true,
|
|
74
|
+
"message" => 'Message sent! Thanks for contacting us.'
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
$response = [
|
|
79
|
+
"status" => false,
|
|
80
|
+
"message" => 'Invalid email address, message ignored.'
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if ($isAjax) {
|
|
85
|
+
header('Content-type:application/json;charset=utf-8');
|
|
86
|
+
echo json_encode($response);
|
|
87
|
+
exit();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
?>
|
|
91
|
+
<!DOCTYPE html>
|
|
92
|
+
<html lang="en">
|
|
93
|
+
<head>
|
|
94
|
+
<meta charset="UTF-8">
|
|
95
|
+
<title>Contact form</title>
|
|
96
|
+
</head>
|
|
97
|
+
<body>
|
|
98
|
+
<h1>Contact us</h1>
|
|
99
|
+
<h2 id="status-message"><?php if (isset($response)) {
|
|
100
|
+
echo $response['message'];
|
|
101
|
+
}?></h2>
|
|
102
|
+
<form method="POST" id="contact-form">
|
|
103
|
+
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
|
|
104
|
+
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
|
|
105
|
+
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
|
|
106
|
+
<label for="dept">Send query to department:</label>
|
|
107
|
+
<select name="dept" id="dept">
|
|
108
|
+
<option value="sales">Sales</option>
|
|
109
|
+
<option value="support" selected>Technical support</option>
|
|
110
|
+
<option value="accounts">Accounts</option>
|
|
111
|
+
</select><br>
|
|
112
|
+
<input type="submit" value="Send">
|
|
113
|
+
</form>
|
|
114
|
+
|
|
115
|
+
<script type="application/javascript">
|
|
116
|
+
const form = document.getElementById("contact-form")
|
|
117
|
+
|
|
118
|
+
function email(data) {
|
|
119
|
+
const message = document.getElementById("status-message")
|
|
120
|
+
fetch("", {
|
|
121
|
+
method: "POST",
|
|
122
|
+
body: data,
|
|
123
|
+
headers: {
|
|
124
|
+
'X-Requested-With' : 'XMLHttpRequest'
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
.then(response => response.json())
|
|
128
|
+
.then(response => {message.innerHTML = response.message})
|
|
129
|
+
.catch(error => {
|
|
130
|
+
error.json().then(response => {
|
|
131
|
+
message.innerHTML = response.message
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const submitEvent = form.addEventListener("submit", (event) => {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
|
|
140
|
+
const formData = new FormData(form);
|
|
141
|
+
|
|
142
|
+
email(formData);
|
|
143
|
+
})
|
|
144
|
+
</script>
|
|
145
|
+
</body>
|
|
146
|
+
</html>
|