Showing preview only (961K chars total). Download the full file or copy to clipboard to get everything.
Repository: PHPMailer/PHPMailer
Branch: master
Commit: 359030eb7a1a
Files: 186
Total size: 907.5 KB
Directory structure:
gitextract_zz4pddvj/
├── .codecov.yml
├── .editorconfig
├── .gitattributes
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ └── bug_report.md
│ ├── actions/
│ │ └── build-docs/
│ │ ├── Dockerfile
│ │ └── entrypoint.sh
│ ├── dependabot.yml
│ └── workflows/
│ ├── docs.yaml
│ ├── scorecards.yml
│ └── tests.yml
├── .gitignore
├── .phan/
│ └── config.php
├── COMMITMENT
├── LICENSE
├── README.md
├── SECURITY.md
├── SMTPUTF8.md
├── UPGRADING.md
├── VERSION
├── changelog.md
├── composer.json
├── docs/
│ └── README.md
├── examples/
│ ├── DKIM_gen_keys.phps
│ ├── DKIM_sign.phps
│ ├── README.md
│ ├── azure_xoauth2.phps
│ ├── callback.phps
│ ├── contactform-ajax.phps
│ ├── contactform.phps
│ ├── contents.html
│ ├── contentsutf8.html
│ ├── exceptions.phps
│ ├── extending.phps
│ ├── gmail.phps
│ ├── gmail_xoauth.phps
│ ├── images/
│ │ └── PHPMailer card logo.afdesign
│ ├── mail.phps
│ ├── mailing_list.phps
│ ├── pop_before_smtp.phps
│ ├── send_file_upload.phps
│ ├── send_multiple_file_upload.phps
│ ├── sendmail.phps
│ ├── sendoauth2.phps
│ ├── simple_contact_form.phps
│ ├── smime_signed_mail.phps
│ ├── smtp.phps
│ ├── smtp_check.phps
│ ├── smtp_low_memory.phps
│ ├── smtp_no_auth.phps
│ └── ssl_options.phps
├── get_oauth_token.php
├── language/
│ ├── phpmailer.lang-af.php
│ ├── phpmailer.lang-ar.php
│ ├── phpmailer.lang-as.php
│ ├── phpmailer.lang-az.php
│ ├── phpmailer.lang-ba.php
│ ├── phpmailer.lang-be.php
│ ├── phpmailer.lang-bg.php
│ ├── phpmailer.lang-bn.php
│ ├── phpmailer.lang-ca.php
│ ├── phpmailer.lang-cs.php
│ ├── phpmailer.lang-da.php
│ ├── phpmailer.lang-de.php
│ ├── phpmailer.lang-el.php
│ ├── phpmailer.lang-eo.php
│ ├── phpmailer.lang-es.php
│ ├── phpmailer.lang-et.php
│ ├── phpmailer.lang-fa.php
│ ├── phpmailer.lang-fi.php
│ ├── phpmailer.lang-fo.php
│ ├── phpmailer.lang-fr.php
│ ├── phpmailer.lang-gl.php
│ ├── phpmailer.lang-he.php
│ ├── phpmailer.lang-hi.php
│ ├── phpmailer.lang-hr.php
│ ├── phpmailer.lang-hu.php
│ ├── phpmailer.lang-hy.php
│ ├── phpmailer.lang-id.php
│ ├── phpmailer.lang-it.php
│ ├── phpmailer.lang-ja.php
│ ├── phpmailer.lang-ka.php
│ ├── phpmailer.lang-ko.php
│ ├── phpmailer.lang-ku.php
│ ├── phpmailer.lang-lt.php
│ ├── phpmailer.lang-lv.php
│ ├── phpmailer.lang-mg.php
│ ├── phpmailer.lang-mn.php
│ ├── phpmailer.lang-ms.php
│ ├── phpmailer.lang-nb.php
│ ├── phpmailer.lang-nl.php
│ ├── phpmailer.lang-pl.php
│ ├── phpmailer.lang-pt.php
│ ├── phpmailer.lang-pt_br.php
│ ├── phpmailer.lang-ro.php
│ ├── phpmailer.lang-ru.php
│ ├── phpmailer.lang-si.php
│ ├── phpmailer.lang-sk.php
│ ├── phpmailer.lang-sl.php
│ ├── phpmailer.lang-sr.php
│ ├── phpmailer.lang-sr_latn.php
│ ├── phpmailer.lang-sv.php
│ ├── phpmailer.lang-tl.php
│ ├── phpmailer.lang-tr.php
│ ├── phpmailer.lang-uk.php
│ ├── phpmailer.lang-ur.php
│ ├── phpmailer.lang-vi.php
│ ├── phpmailer.lang-zh.php
│ └── phpmailer.lang-zh_cn.php
├── phpcs.xml.dist
├── phpdoc.dist.xml
├── phpunit.xml.dist
├── src/
│ ├── DSNConfigurator.php
│ ├── Exception.php
│ ├── OAuth.php
│ ├── OAuthTokenProvider.php
│ ├── PHPMailer.php
│ ├── POP3.php
│ └── SMTP.php
└── test/
├── DebugLogTestListener.php
├── Fixtures/
│ ├── FileIsAccessibleTest/
│ │ ├── accessible.txt
│ │ └── inaccessible.txt
│ └── LocalizationTest/
│ ├── phpmailer.lang-fr.php
│ ├── phpmailer.lang-nl.php
│ ├── phpmailer.lang-xa_scri_cc.php
│ ├── phpmailer.lang-xb_scri.php
│ ├── phpmailer.lang-xc_cc.php
│ ├── phpmailer.lang-xd_cc.php
│ ├── phpmailer.lang-xd_scri.php
│ ├── phpmailer.lang-xe.php
│ ├── phpmailer.lang-xx.php
│ ├── phpmailer.lang-yy.php
│ ├── phpmailer.lang-yz.php
│ └── phpmailer.lang-zz.php
├── Language/
│ └── TranslationCompletenessTest.php
├── OAuth/
│ └── OAuthTest.php
├── PHPMailer/
│ ├── AddEmbeddedImageTest.php
│ ├── AddStringAttachmentTest.php
│ ├── AddStringEmbeddedImageTest.php
│ ├── AddrFormatTest.php
│ ├── AuthCRAMMD5Test.php
│ ├── CustomHeaderTest.php
│ ├── DKIMTest.php
│ ├── DKIMWithoutExceptionsTest.php
│ ├── DSNConfiguratorTest.php
│ ├── EmptyMailerTest.php
│ ├── EncodeQTest.php
│ ├── EncodeStringTest.php
│ ├── FileIsAccessibleTest.php
│ ├── FilenameToTypeTest.php
│ ├── GenerateIdTest.php
│ ├── GetLastMessageIDTest.php
│ ├── HasLineLongerThanMaxTest.php
│ ├── Html2TextTest.php
│ ├── ICalTest.php
│ ├── IsPermittedPathTest.php
│ ├── IsValidHostTest.php
│ ├── LocalizationTest.php
│ ├── MailTransportTest.php
│ ├── MbPathinfoTest.php
│ ├── MimeTypesTest.php
│ ├── NormalizeBreaksTest.php
│ ├── PHPMailerTest.php
│ ├── ParseAddressesTest.php
│ ├── PunyencodeAddressTest.php
│ ├── QuotedStringTest.php
│ ├── ReplyToGetSetClearTest.php
│ ├── SetErrorTest.php
│ ├── SetFromTest.php
│ ├── SetTest.php
│ ├── SetWordWrapTest.php
│ ├── Utf8CharBoundaryTest.php
│ ├── ValidateAddressCustomValidatorTest.php
│ ├── ValidateAddressTest.php
│ ├── WrapTextTest.php
│ └── XMailerTest.php
├── POP3/
│ └── PopBeforeSmtpTest.php
├── PreSendTestCase.php
├── Security/
│ └── DenialOfServiceVectorsTest.php
├── SendTestCase.php
├── TestCase.php
├── fakepopserver.sh
├── fakesendmail.sh
├── runfakepopserver.sh
├── testbootstrap-dist.php
└── validators.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .codecov.yml
================================================
codecov:
notify:
after_n_builds: 2
coverage:
round: nearest
# Status will be green when coverage is between 70 and 100%.
range: "70...100"
status:
project:
default:
threshold: 2%
paths:
- "src"
patch:
default:
threshold: 0%
paths:
- "src"
comment: false
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
================================================
FILE: .gitattributes
================================================
* text=auto
/.codecov.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.phan export-ignore
/.scrutinizer.yml export-ignore
/changelog.md export-ignore
/docs export-ignore
/examples export-ignore
/phpcs.xml.dist export-ignore
/phpdoc.dist.xml export-ignore
/phpunit.xml.dist export-ignore
/test export-ignore
/UPGRADING.md export-ignore
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: Synchro
patreon: marcusbointon
tidelift: "packagist/phpmailer/phpmailer"
custom: https://marcus.bointon.com/donations/
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: If you've found a bug in PHPMailer, this is the right place to report it
title: ''
labels: ''
assignees: ''
---
Please check these things before submitting your issue:
- [ ] *Read the error message* you're seeing - it often tells you what is wrong, and may contain useful links & instructions
- [ ] Make sure you're using the latest version of PHPMailer
- [ ] Check that your problem is not dealt with in [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting), especially if you're having problems connecting to Gmail or GoDaddy
- [ ] Include sufficient code to reproduce your problem
- [ ] If you're having an SMTP issue, include the debug output generated with `SMTPDebug = 2` set
- [ ] If you have a question about how to use PHPMailer (rather than reporting a bug in it), tag a question on Stack Overflow with `phpmailer`, but [**search first**](https://stackoverflow.com/questions/tagged/phpmailer)!
# Problem description
# Code to reproduce
# Debug output
================================================
FILE: .github/actions/build-docs/Dockerfile
================================================
FROM phpdoc/phpdoc
LABEL "repository"="https://github.com/PHPMailer/PHPMailer"
LABEL "com.github.actions.name"="Build Docs"
LABEL "com.github.actions.description"="Build Docs with phpDocumentor"
LABEL "com.github.actions.icon"="file-text"
LABEL "com.github.actions.color"="blue"
# don't show errors
RUN echo "display_errors = Off" > $PHP_INI_DIR/conf.d/errors.ini
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
================================================
FILE: .github/actions/build-docs/entrypoint.sh
================================================
#!/bin/sh
set -eu
/opt/phpdoc/bin/phpdoc
================================================
FILE: .github/dependabot.yml
================================================
# Dependabot configuration.
#
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "cron"
cronjob: "10 22 5,20 * *" # At 22:10, every 5th and 20th day of the month.
open-pull-requests-limit: 5
commit-message:
prefix: "GH Actions:"
groups:
action-runners:
applies-to: version-updates
update-types:
- "minor"
- "patch"
================================================
FILE: .github/workflows/docs.yaml
================================================
name: Docs
on:
push:
branches:
- master
permissions: {}
jobs:
build_and_publish:
permissions:
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
name: Build and publish Docs
runs-on: ubuntu-latest
if: github.repository == 'PHPMailer/PHPMailer'
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Build Docs
uses: ./.github/actions/build-docs
- name: Publish Docs to gh-pages
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
branch: gh-pages
folder: docs
env:
BUILD_DIR: docs/
GH_PAT: ${{ secrets.GH_PAT }}
================================================
FILE: .github/workflows/scorecards.yml
================================================
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
branch_protection_rule:
schedule:
- cron: '39 20 * * 1'
push:
branches: [ "master" ]
permissions: {}
jobs:
analysis:
# Don't run the cron job on forks.
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Required when publishing results (badge / API / code scanning)
security-events: write
id-token: write
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
with:
sarif_file: results.sarif
================================================
FILE: .github/workflows/tests.yml
================================================
name: "Tests"
on:
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
permissions: {}
jobs:
coding-standard:
runs-on: ubuntu-22.04
name: Coding standards
permissions:
contents: read # to fetch code (actions/checkout)
steps:
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: 'latest'
coverage: none
tools: cs2pr
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Check coding standards
id: phpcs
run: ./vendor/bin/phpcs -s --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml
lint:
runs-on: ubuntu-22.04
strategy:
matrix:
php: ['5.5', '7.2', '8.0', '8.5']
experimental: [false]
include:
- php: 'nightly'
experimental: true
name: "Lint: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}
permissions:
contents: read # to fetch code (actions/checkout)
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=-1, display_errors=On, display_startup_errors=On
coverage: none
tools: cs2pr
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Lint against parse errors
if: ${{ matrix.php != 'nightly' }}
run: composer lint -- --checkstyle | cs2pr
- name: Lint against future parse errors (PHP nightly)
if: ${{ matrix.php == 'nightly' }}
run: composer lint
test:
needs: ['coding-standard', 'lint']
runs-on: ubuntu-22.04
strategy:
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
extensions: ['optimal', 'minimal']
coverage: [false]
experimental: [false]
include:
# Run code coverage on high/low PHP.
- php: '5.5'
extensions: 'optimal'
coverage: true
experimental: false
- php: '5.5'
extensions: 'minimal'
coverage: true
experimental: false
- php: '8.5'
extensions: 'optimal'
coverage: true
experimental: false
- php: '8.5'
extensions: 'minimal'
coverage: true
experimental: false
# Experimental builds. These are allowed to fail.
- php: '8.6'
extensions: 'optimal'
coverage: false
experimental: true
- php: '8.6'
extensions: 'minimal'
coverage: false
experimental: true
name: "Test: PHP ${{ matrix.php }} - ${{ matrix.extensions }}"
continue-on-error: ${{ matrix.experimental }}
permissions:
contents: read # to fetch code (actions/checkout)
steps:
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# About the "extensions":
#
# In a "normal" test run, the "default" extension set for a PHP version is used
# and it is ensured that certain extensions will be available, no matter what.
#
# For the "minimal" test run, all extensions are disabled and then only
# a limited set of minimally required extensions are re-enabled.
# The minimal set is based on the required extensions from PHPUnit + PHPMailer combined
# + Curl for Composer.
# Whether Xdebug will be enabled depends on the code coverage settings.
#
# Also see:
# https://github.com/shivammathur/setup-php/?tab=readme-ov-file#heavy_plus_sign-php-extension-support
# https://github.com/shivammathur/setup-php/wiki
- name: Determine extensions to use
id: set_extensions
run: |
if [[ "${{ matrix.extensions }}" == "optimal" ]]; then
# Optimal.
echo 'EXT=imap, mbstring, openssl, intl, ctype, filter, hash' >> $GITHUB_OUTPUT
echo 'COMPOSER_OPTIONS=' >> $GITHUB_OUTPUT
else
# Minimal.
echo 'EXT=none, curl, dom, json, libxml, mbstring, tokenizer, xml, xmlwriter, ctype, filter, hash' >> $GITHUB_OUTPUT
echo 'COMPOSER_OPTIONS=--ignore-platform-req=ext-simplexml' >> $GITHUB_OUTPUT
fi
- name: Set up PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-values: sendmail_path=/usr/sbin/sendmail -t -i, error_reporting=-1, display_errors=On, display_startup_errors=On
extensions: ${{ steps.set_extensions.outputs.EXT }}
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install PHP packages - normal
if: ${{ matrix.php != '8.6' }}
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
with:
composer-options: ${{ steps.set_extensions.outputs.COMPOSER_OPTIONS }}
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Install PHP packages - ignore-platform-reqs
if: ${{ matrix.php == '8.6' }}
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
with:
composer-options: --ignore-platform-reqs ${{ steps.set_extensions.outputs.COMPOSER_OPTIONS }}
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
# Install postfix and automatically retry if the install failed, which happens reguarly.
# @link https://github.com/marketplace/actions/retry-step
- name: Install postfix
uses: nick-invision/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
timeout_minutes: 2
max_attempts: 3
retry_wait_seconds: 8
command: |
sudo apt-get install --fix-broken -y libsqlite3-0 postfix
sudo systemctl stop postfix.service
- name: Set up sendmail
run: |
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
mkdir -p build/logs
sudo cp test/testbootstrap-dist.php test/testbootstrap.php
sudo chmod +x test/fakesendmail.sh
sudo mkdir -p /var/qmail/bin
sudo cp test/fakesendmail.sh /var/qmail/bin/sendmail
sudo cp test/fakesendmail.sh /usr/sbin/sendmail
- name: Run tests, no code coverage
if: ${{ matrix.coverage == false }}
run: ./vendor/bin/phpunit --no-coverage
- name: Run tests with code coverage
if: ${{ matrix.coverage == true }}
run: vendor/bin/phpunit
- name: Send coverage report to Codecov
if: ${{ success() && matrix.coverage == true && github.event.repository.fork == false }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./build/logs/clover.xml
fail_ci_if_error: true
verbose: true
================================================
FILE: .gitignore
================================================
docs/*
!docs/README.md
test/message.txt
test/testbootstrap.php
build/
vendor/
*.pem
composer.lock
.phpcs.xml
phpcs.xml
.phpcs-cache
/.rnd
test/PHPMailerTest.php*nonexistent_file.txt
test/*/PHPMailerTest.php*nonexistent_file.txt
phpunit.xml
/.phpunit.result.cache
================================================
FILE: .phan/config.php
================================================
<?php
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'src',
'vendor',
'examples'
],
// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'vendor/'
],
'skip_slow_php_options_warning' => true,
'exclude_file_regex' => '@^vendor/.*/(tests|Tests)/@',
];
================================================
FILE: COMMITMENT
================================================
GPL Cooperation Commitment
Version 1.0
Before filing or continuing to prosecute any legal proceeding or claim
(other than a Defensive Action) arising from termination of a Covered
License, we commit to extend to the person or entity ('you') accused
of violating the Covered License the following provisions regarding
cure and reinstatement, taken from GPL version 3. As used here, the
term 'this License' refers to the specific Covered License being
enforced.
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the
copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you
have received notice of violation of this License (for any work)
from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.
We intend this Commitment to be irrevocable, and binding and
enforceable against us and assignees of or successors to our
copyrights.
Definitions
'Covered License' means the GNU General Public License, version 2
(GPLv2), the GNU Lesser General Public License, version 2.1
(LGPLv2.1), or the GNU Library General Public License, version 2
(LGPLv2), all as published by the Free Software Foundation.
'Defensive Action' means a legal proceeding or claim that We bring
against you in response to a prior proceeding or claim initiated by
you or your affiliate.
'We' means each contributor to this repository as of the date of
inclusion of this file, including subsidiaries of a corporate
contributor.
This work is available under a Creative Commons Attribution-ShareAlike
4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).
================================================
FILE: LICENSE
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
================================================
FILE: README.md
================================================
[](https://supportukrainenow.org/)

# PHPMailer – A full-featured email creation and transfer class for PHP
[](https://github.com/PHPMailer/PHPMailer/actions)
[](https://codecov.io/gh/PHPMailer/PHPMailer)
[](https://packagist.org/packages/phpmailer/phpmailer)
[](https://packagist.org/packages/phpmailer/phpmailer)
[](https://packagist.org/packages/phpmailer/phpmailer)
[](https://phpmailer.github.io/PHPMailer/)
[](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer)
## Features
- Probably the world's most popular code for sending email from PHP!
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
- Integrated SMTP support – send without a local mail server
- Send emails with multiple To, CC, BCC, and Reply-to addresses
- Multipart/alternative emails for mail clients that do not read HTML email
- Add attachments, including inline
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
- Full UTF-8 support when using servers that support `SMTPUTF8`.
- Support for iCal events in multiparts and attachments
- SMTP authentication with `LOGIN`, `PLAIN`, `CRAM-MD5`, and `XOAUTH2` mechanisms over SMTPS and SMTP+STARTTLS transports
- Validates email addresses automatically
- Protects against header injection attacks
- Error messages in over 50 languages!
- DKIM and S/MIME signing support
- Compatible with PHP 5.5 and later, including PHP 8.5
- Namespaced to prevent name clashes
- Much more!
## Why you might need it
Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as authentication, HTML messages, and attachments.
Formatting email correctly is surprisingly difficult. There are myriad overlapping (and conflicting) standards, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong, if not unsafe!
The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP client allows email sending on all platforms without needing a local mail server. Be aware though, that the `mail()` function should be avoided when possible; it's both faster and [safer](https://exploitbox.io/paper/Pwning-PHP-Mail-Function-For-Fun-And-RCE.html) to use SMTP to localhost.
*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that
you should look at before rolling your own. Try [Symfony Mailer](https://symfony.com/doc/current/mailer.html), [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail), etc.
## License
This software is distributed under the [LGPL 2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution.
## Installation & loading
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
"phpmailer/phpmailer": "^7.0.0"
```
or run
```sh
composer require phpmailer/phpmailer
```
Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer.
If you want to use XOAUTH2 authentication, you will also need to add a dependency on the `league/oauth2-client` and appropriate service adapters package in your `composer.json`, or take a look at
by @decomplexity's [SendOauth2 wrapper](https://github.com/decomplexity/SendOauth2), especially if you're using Microsoft services.
Alternatively, if you're not using Composer, you
can [download PHPMailer as a zip file](https://github.com/PHPMailer/PHPMailer/archive/master.zip), (note that docs and examples are not included in the zip file), then copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
```php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';
```
If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for it. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally.
## Legacy versions
PHPMailer 5.2 (which is compatible with PHP 5.0 — 7.0) is no longer supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
### Upgrading from 5.2
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
### Minimal installation
While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP (*very* unlikely!), you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
## A Simple Example
```php
<?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader (created by composer, not included with PHPMailer)
require 'vendor/autoload.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.example.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'user@example.com'; //SMTP username
$mail->Password = 'secret'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('joe@example.net', 'Joe User'); //Add a recipient
$mail->addAddress('ellen@example.com'); //Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
//Attachments
$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
```
You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through Gmail, building contact forms, sending to mailing lists, and more.
If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
That's it. You should now be ready to use PHPMailer!
## Localization
PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder, you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
```php
//To load the French version
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
```
We welcome corrections and new languages – if you're looking for corrections, run the [Language/TranslationCompletenessTest.php](https://github.com/PHPMailer/PHPMailer/blob/master/test/Language/TranslationCompletenessTest.php) script in the tests folder and it will show any missing translations.
## Documentation
Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated.
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
To reduce PHPMailer's deployed code footprint, examples are not included if you load PHPMailer via Composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
Complete generated API documentation is [available online](https://phpmailer.github.io/PHPMailer/).
You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](https://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailer/PHPMailerTest.php) a good reference for how to do various operations such as encryption.
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](https://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
## Tests
[PHPMailer tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/) use PHPUnit 9, with [a polyfill](https://github.com/Yoast/PHPUnit-Polyfills) to let 9-style tests run on older PHPUnit and PHP versions.
[](https://github.com/PHPMailer/PHPMailer/actions)
If this isn't passing, is there something you can do to help?
## Security
Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.
See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security).
## Contributing
Please submit bug reports, suggestions, and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
We're particularly interested in fixing edge cases, expanding test coverage, and updating translations.
If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it.
If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
```sh
git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
```
Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
## Sponsorship
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), the world's only privacy-first email marketing system.
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="550" alt="Smartmessages.net privacy-first email marketing logo"></a>
Donations are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard cash 💰. Sponsorship through GitHub is a simple and convenient way to say "thank you" to PHPMailer's maintainers and contributors – just click the "Sponsor" button [on the project page](https://github.com/PHPMailer/PHPMailer). If your company uses PHPMailer, consider taking part in Tidelift's enterprise support programme.
## PHPMailer For Enterprise
Available as part of the Tidelift Subscription.
The maintainers of PHPMailer and thousands of other packages are working with Tidelift to deliver commercial
support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and
improve code health, while paying the maintainers of the exact packages you
use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-phpmailer?utm_source=packagist-phpmailer-phpmailer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Changelog
See [changelog](changelog.md).
## History
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](https://sourceforge.net/projects/phpmailer/).
- [Marcus Bointon](https://github.com/Synchro) (`coolbru` on SF) and Andy Prevost (`codeworxtech`) took over the project in 2004.
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
- Marcus created [his fork on GitHub](https://github.com/Synchro/PHPMailer) in 2008.
- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
- PHPMailer moves to [the PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
### What's changed since moving from SourceForge?
- Official successor to the SourceForge and Google Code projects.
- Test suite.
- Continuous integration with GitHub Actions.
- Composer support.
- Public development.
- Additional languages and language strings.
- CRAM-MD5 authentication support.
- Preserves full repo history of authors, commits, and branches from the original SourceForge project.
================================================
FILE: SECURITY.md
================================================
# Security notices relating to PHPMailer
Please disclose any security issues or vulnerabilities found through [Tidelift's coordinated disclosure system](https://tidelift.com/security) or to the maintainers privately.
PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the `$patternselect` parameter to `validateAddress()` is set to `'php'` (the default, defined by `PHPMailer::$validator`), and the global namespace contains a function called `php`, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names. Recorded as [CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603). Reported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/).
PHPMailer versions 6.4.1 and earlier contain a possible remote code execution vulnerability through the `$lang_path` parameter of the `setLanguage()` method. If the `$lang_path` parameter is passed unfiltered from user input, it can be set to [a UNC path](https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths), and if an attacker is also able to persuade the server to load a file from that UNC path, a script file under their control may be executed. This vulnerability only applies to systems that resolve UNC paths, typically only Microsoft Windows.
PHPMailer 6.5.0 mitigates this by no longer treating translation files as PHP code, but by parsing their text content directly. This approach avoids the possibility of executing unknown code while retaining backward compatibility. This isn't ideal, so the current translation format is deprecated and will be replaced in the next major release. Recorded as [CVE-2021-34551](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-34551). Reported by [Jilin Diting Information Technology Co., Ltd](https://listensec.com) via Tidelift.
PHPMailer versions between 6.1.8 and 6.4.0 contain a regression of the earlier CVE-2018-19296 object injection vulnerability as a result of [a fix for Windows UNC paths in 6.1.8](https://github.com/PHPMailer/PHPMailer/commit/e2e07a355ee8ff36aba21d0242c5950c56e4c6f9). Recorded as [CVE-2020-36326](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-36326). Reported by Fariskhi Vidyan via Tidelift. 6.4.1 fixes this issue, and also enforces stricter checks for URL schemes in local path contexts.
PHPMailer versions 6.1.5 and earlier contain an output escaping bug that occurs in `Content-Type` and `Content-Disposition` when filenames passed into `addAttachment` and other methods that accept attachment names contain double quote characters, in contravention of RFC822 3.4.1. No specific vulnerability has been found relating to this, but it could allow file attachments to bypass attachment filters that are based on matching filename extensions. Recorded as [CVE-2020-13625](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-13625). Reported by Elar Lang of Clarified Security.
PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr.
PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending.
PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).
================================================
FILE: SMTPUTF8.md
================================================
# A short history of UTF-8 in email
## Background
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.
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.
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.
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:
```
Subject: =?utf-8?Q=Schr=C3=B6dinger=92s_Cat?=
```
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.
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.
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
`user@café.example.com` translates to
`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.
The one remaining part of email that could not handle UTF-8 is the local part of email addresses (the part before the `@`).
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.
This patchwork of overlapping approaches has served us well, but we have to admit that it's a mess.
## SMTPUTF8
`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.
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 😅.
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.
## SMTPUTF8 in PHPMailer
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.
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.
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).
### Postfix gotcha
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.
================================================
FILE: UPGRADING.md
================================================
# Upgrading from PHPMailer 5.2 to 6.0
PHPMailer 6.0 is a major update, breaking backward compatibility.
If you're in doubt about how you should be using PHPMailer 6, take a look at the examples as they have all been updated to work in a PHPMailer 6.0 style.
## PHP Version
PHPMailer 6.0 requires PHP 5.5 or later, and is fully compatible with PHP versions all the way up to 8.4. PHPMailer 5.2 supported PHP 5.0 and upwards, so if you need to run on a legacy PHP version, see the [PHPMailer 5.2-stable branch on Github](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable), but bear in mind that this branch is no longer maintained.
## Loading PHPMailer
The single biggest change will be in the way that you load PHPMailer. In earlier versions you may have done this:
```php
require 'PHPMailerAutoload.php';
```
or
```php
require 'class.phpmailer.php';
require 'class.smtp.php';
```
We recommend that you load PHPMailer via composer, using its standard autoloader, which you probably won't need to load if you're using it already, but in case you're not, you will need to do this instead:
```php
require 'vendor/autoload.php';
```
If you're not using composer, you can still load the classes manually, depending on what you're using:
```php
require 'src/PHPMailer.php';
require 'src/SMTP.php';
require 'src/Exception.php';
```
## Namespace
PHPMailer 6 uses a [namespace](https://www.php.net/manual/en/language.namespaces.rationale.php) of `PHPMailer\PHPMailer`, because it's the PHPMailer project within the PHPMailer organisation. You **must** import (with a `use` statement) classes you're using explicitly into your own namespace, or reference them absolutely in the global namespace - all the examples do this. This means the fully-qualified name of the main PHPMailer class is `PHPMailer\PHPMailer\PHPMailer`, which is a bit of a mouthful, but there's no harm in it! If you are using other PHPMailer classes explicitly (such as `SMTP` or `Exception`), you will need to import them into your namespace too.
For example you might create an instance like this:
```php
<?php
namespace MyProject;
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
$mail = new PHPMailer;
...
```
or alternatively, using a fully qualified name:
```php
<?php
namespace MyProject;
require 'vendor/autoload.php';
$mail = new PHPMailer\PHPMailer\PHPMailer;
...
```
Note that `use` statements apply *only* to the file they appear in (they are local aliases), so if an included file contains `use` statements, it will not import the namespaced classes into the file you're including from.
## Namespaced exceptions
PHPMailer now uses its own namespaced `Exception` class, so if you were previously catching exceptions of type `phpmailerException` (or subclasses of that), you will need to update them to use the PHPMailer namespace, and make any existing `Exception` references use the global namespace, i.e. `\Exception`. If your original code was:
```php
try {
...
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
```
Convert it to:
```php
use PHPMailer\PHPMailer\Exception;
...
try {
...
} catch (Exception $e) {
echo $e->errorMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}
```
## OAuth2 Support
The OAuth2 implementation has been completely redesigned using the [OAuth2 packages](https://oauth2-client.thephpleague.com) from the [League of extraordinary packages](https://thephpleague.com), providing support for many more OAuth services, and you'll need to update your code if you were using OAuth in 5.2. See [the examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) and documentation in the [PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki).
## Extras
Additional classes previously bundled in the `Extras` folder (such as htmlfilter and EasyPeasyICS) have been removed - use equivalent packages from [packagist.org](https://packagist.org) instead.
## Other upgrade changes
See the changelog for full details.
* File structure simplified, classes live in the `src/` folder
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks by default:
* `PHPMailer::$LE` still exists, but all uses of it are changed to `static::$LE` for easier overriding. It may be changed to `\n` automatically when sending via `mail()` on UNIX-like OSs
* `PHPMailer::CRLF` line ending constant removed
* The length of the line break is no longer used in line length calculations
* Similar changes to line break handling in SMTP and POP3 classes
* All elements previously marked as deprecated have been removed:
* `PHPMailer->Version`
* `PHPMailer->ReturnPath`
* `PHPMailer->PluginDir`
* `PHPMailer->encodeQPphp()`
* `SMTP->CRLF`
* `SMTP->Version`
* `SMTP->SMTP_PORT`
* `POP3->CRLF`
* `POP3->Version`
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected
================================================
FILE: VERSION
================================================
7.0.2
================================================
FILE: changelog.md
================================================
# PHPMailer Change Log
## Version 7.0.2 (January 9th, 2026)
* Fixes for sendmail parameter problems in WordPress, thanks to @SirLouen
* Reduce memory consumption when sending large attachments by @RobinvanderVliet
## Version 7.0.1 (November 25th, 2025)
* Use From domain when generating CIDs in msgHTML.
* Update to PHPCompatibility 10, resolve numerous PHPCS issues in PHP 8.5.
* Revise GitHub actions for PHP 8.5 and experimental 8.6 tests.
* Switch gmail example from the deprecated IMAP extension to use `directorytree/imapengine` for IMAP uploads.
* Set `htmlspecialchars()` flags explicitly and consistently.
* Convert XOAUTH2 token exceptions into PHPMailer Exceptions. The original exception is available as an inner exception.
* Deprecate VERSION constants in POP3 and SMTP classes.
* Remove dependency on `roave/security-advisories`; it's now built into composer 2.9.
* Update Dutch, Esperanto, and Norwegian translations.
## Version 7.0.0 (October 15th, 2025)
This is exactly the same as 6.11.1 but bumps the major version number to indicate the presence of a BC break in child classes. Specifically, `lang()`, `setLanguage()`, and `$language` are now static, and should be called statically.
## Version 6.12.0 (October 15th, 2025)
This is exactly the same as 6.10.0, reverting all the changes in 6.11.0 and 6.11.1, which inadvertently introduced a BC break affecting child classes. 6.11.1 has been re-released as 7.0.0.
## Version 6.11.1 (September 30th, 2025)
* Avoid function signature problems with the deprecation of `$useimap` in `parseAddresses`.
## Version 6.11.0 (September 29th, 2025)
* Add support for [RFC4954](https://www.rfc-editor.org/rfc/rfc4954#section-4) two-part authentication for large XOAUTH2 tokens.
* Also support empty tokens.
* Avoid bogus static analyser deprecation warnings in `setFrom`.
* Make language loading entirely static, thanks to @SirLouen.
* Emit warnings when `parseAddresses()` is used without the IMAP extension.
* Handle `mb_decode_mimeheader` changes from PHP 8.3+.
* Deprecate the charset param to parseAddresses.
* Fix PHP 8.5 linting issue.
* Don't use `-t` switch when calling qmail.
* Checking for interrupted system calls now works in languages other than English.
* Add support for extracting gmail transaction IDs after sending.
* For consistency, the protected `ReplyTo` property has been changed to match the format used for other address arrays.
* Fix line length issues when using S/MIME signing.
* Pin action runners to exact versions to avoid unexpected upstream changes.
## Version 6.10.0 (April 24th, 2025)
* Add support for [RFC 6530 SMTPUTF8](https://www.rfc-editor.org/rfc/rfc6530), permitting use of UTF-8 Unicode characters everywhere, thanks to @arnt and ICANN. See `SMTPUTF8.md` for details.
* More reliable checking for multibyte support.
## Version 6.9.3 (November 22nd, 2024)
* Add support for the release version of PHP 8.4
* Add experimental support for PHP 8.5
* Use rfc-editor.org for all RFC docs links
## Version 6.9.2 (October 9th, 2024)
* Escape dots in SMTP transaction ID patterns
* Add link to [aboutmy.email](https://aboutmy.email) testing service in docs
* Add a more comprehensive example for using XOAUTH2 with gmail and Azure, thanks to @decomplexity
* Update Turkish, Spanish, Japanese, Russian, French translations
* Add Urdu & Kurdish (Sorani) translations
* Fix broken links in docs and comments, avoid http links, correct link to LGPL 2.1 license file
* Cleaner PSR-3 SMTP debug logging
* Bump GitHub action versions
* Fix error handler scope issue in POP3 and SMTP classes
* Numerous test improvements by @jrfnl
## Version 6.9.1 (November 25th, 2023)
* Finalise SendOauth2 example
## Version 6.9.0 (November 23rd, 2023)
* Add support for official release of PHP 8.3, add experimental support for PHP 8.4
* Add `clearCustomHeader` and `replaceCustomHeader` methods
* Add support for the XCLIENT SMTP extension with `setSMTPXclientAttribute` and `getSMTPXclientAttributes` methods
* Don't attempt opportunistic TLS when connecting to localhost
* Add package link and example showing how to use @decomplexity's SendOauth2 wrapper
* Update example to show a better way of using an SMTP subclass
* Avoid some more deprecation warnings
* Update Danish and Polish translations
* Add Bengali and Assamese translations
## Version 6.8.1 (August 29th, 2023)
* Don't reflect malformed DSNs in error messages to avert any risk of XSS
* Improve Simplified Chinese, Sinhalese, and Norwegian translations
* Don't use `setAccessible` in PHP >= 8.1 in tests
* Avoid a deprecation notice in PHP 8.3
* Fix link in readme
## Version 6.8.0 (March 6th, 2023)
* Add DSN parsing class, thanks to @voronkovich
* Fix some name edge cases, expand tests
* Add pattern for ZonMTA message IDs
* Improve Hindi translation
## Version 6.7.1 (December 8th, 2022)
* Add official support for PHP 8.2
* Add PHP 8.3 to test suite with "experimental" status
* Add ext-openssl to composer suggest list
* Bump development dependencies
## Version 6.7 (December 5th, 2022)
* Break out boundary definitions into a method (note that boundary format has also changed slightly)
* Remove MIME preamble to match popular client behaviour, may help with DKIM too
* Fix handling of trailing whitespace in simple DKIM canonicalisation
* Fix some possible POP3 auth issues, including a TCP hang (thanks to @czirkoszoltan)
* Add Azure XOAUTH2 example and docs (thanks to @greew)
* Preserve errors during disconnect
* Avoid some PHP 8.1 type issues
* Update CI to run on Ubuntu 22.04
## Version 6.6.5 (October 7th, 2022)
* Don't try to issue RSET if there has been a connection error
* Reject attempts to add folders as attachments
* Don't suppress earlier error messages on close()
* Handle Host === null better
* Update Danish and Polish translations
* Change recommendation for Microsoft OAuth package to thenetworg/oauth2-azure
* Bump some GitHub action versions
## Version 6.6.4 (August 22nd, 2022)
* Update Greek translation
* Add text/csv MIME type
* Fix DKIM when sending to anonymous group via mail()
* Improve docs around auth following gmail & MS deprecations
* Update GitHub action deps
* Add OpenSSF Scorecard security health metrics
## Version 6.6.3 (June 20th, 2022)
* Add an HTML form to the OAuth setup script
* Minor CS improvements
* Add Mongolian translation
* Remove bogus "ch" translation
## Version 6.6.2 (June 14th, 2022)
* Fix docs deployment GitHub action
* Updates to parallel-lint and console highlighter, thanks to @jrfnl
## Version 6.6.1 (June 14th, 2022) (unreleased)
* Don't clear errors on RSET, so they can still be obtained when using keepalive
* Bump some GitHub action versions
* Fix some tests
* 🇺🇦 Slava Ukraini!
## Version 6.6 (February 28th, 2022)
* Introduce interface for OAuth providers, making it easier to use OAuth libraries other than the League one, thanks to @pdscopes.
* Add more contextual information to TLS connection failure error messages, and throw exceptions on TLS connection errors, thanks to @miken32
## Version 6.5.4 (February 17th, 2022)
* If we can't use escaping functions, refuse to do unsafe things
* Avoid PHP 8.1 trim issue
* Add tests for XMailer
* Fix bug in use of CharSet property
* Fix bug in file upload example
* Update dev dependencies
## Version 6.5.3 (November 25th, 2021)
* Wrong commit tagged for the 6.5.2 release!
* Version file updated
## Version 6.5.2 (November 25th, 2021)
* Enable official support for PHP 8.1
* Enable experimental support for PHP 8.2
* Fix for PHP 5.6
* Fix for incorrect options for punyencoding IDNs
## Version 6.5.1 (August 18th, 2021)
* Provisional support for PHP 8.1
* Major overhaul of test suite
* Add codecov.io coverage reporting
* Prefer implicit TLS on port 465 as default encryption scheme in examples, as per RFC8314
* Fix potential noisy output from IMAP address parser
* Stricter checking of custom MessageID validity
* Replace invalid default From address
* Support fallback for languages, so a request for `pt_xx` will fall back to `pt` rather than the default `en`.
* Support multi-line RFC2047 addresses in parseAddresses
* Improved Japanese translation
Many thanks to @jrfnl for all her work.
## Version 6.5.0 (June 16th, 2021)
* **SECURITY** Fixes CVE-2021-34551, a complex RCE affecting Windows hosts. See [SECURITY.md](SECURITY.md) for details.
* The fix for this issue changes the way that language files are loaded. While they remain in the same PHP-like format, they are processed as plain text, and any code in them will not be run, including operations such as concatenation using the `.` operator.
* *Deprecation* The current translation file format using PHP arrays is now deprecated; the next major version will introduce a new format.
* **SECURITY** Fixes CVE-2021-3603 that may permit untrusted code to be run from an address validator. See [SECURITY.md](SECURITY.md) for details.
* The fix for this issue includes a minor BC break: callables injected into `validateAddress`, or indirectly through the `$validator` class property, may no longer be simple strings. If you want to inject your own validator, provide a closure instead of a function name.
* Haraka message ID strings are now recognised
## Version 6.4.1 (April 29th, 2021)
* **SECURITY** Fixes CVE-2020-36326, a regression of CVE-2018-19296 object injection introduced in 6.1.8, see SECURITY.md for details
* Reject more file paths that look like URLs, matching RFC3986 spec, blocking URLS using schemes such as `ssh2`
* Ensure method signature consistency in `doCallback` calls
* Ukrainian language update
* Add composer scripts for checking coding standards and running tests
## Version 6.4.0 (March 31st, 2021)
* Revert change that made the `mail()` and sendmail transports set the envelope sender if one isn't explicitly provided, as it causes problems described in <https://github.com/PHPMailer/PHPMailer/issues/2298>
* Check for mbstring extension before decoding addresss in `parseAddress`
* Add Serbian Latin translation (`sr_latn`)
* Enrol PHPMailer in Tidelift
## Version 6.3.0 (February 19th, 2021)
* Handle early connection errors such as 421 during connection and EHLO states
* Switch to GitHub Actions for CI
* Generate debug output for `mail()`, sendmail, and qmail transports. Enable using the same mechanism as for SMTP: set `SMTPDebug` > 0
* Make the `mail()` and sendmail transports set the envelope sender the same way as SMTP does, i.e. use whatever `From` is set to, only falling back to the `sendmail_from` php.ini setting if `From` is unset. This avoids errors from the `mail()` function if `Sender` is not set explicitly and php.ini is not configured. This is a minor functionality change, so bumps the minor version number.
* Extend `parseAddresses` to decode encoded names, improve tests
## Version 6.2.0
* PHP 8.0 compatibility, many thanks to @jrf_nl!
* Switch from PHP CS Fixer to PHP CodeSniffer for coding standards
* Create class constants for the debug levels in the POP3 class
* Improve French, Slovenian, and Ukrainian translations
* Improve file upload examples so file extensions are retained
* Resolve PHP 8 line break issues due to a very old PHP bug being fixed
* Avoid warnings when using old openssl functions
* Improve Travis-CI build configuration
## Version 6.1.8 (October 9th, 2020)
* Mark `ext-hash` as required in composer.json. This has long been required, but now it will cause an error at install time rather than runtime, making it easier to diagnose
* Make file upload examples safer
* Update links to SMTP testing servers
* Avoid errors when set_time_limit is disabled (you need better hosting!)
* Allow overriding auth settings for local tests; makes it easy to run tests using HELO
* Recover gracefully from errors during keepalive sessions
* Add AVIF MIME type mapping
* Prevent duplicate `To` headers in BCC-only messages when using `mail()`
* Avoid file function problems when attaching files from Windows UNC paths
* Improve German, Bahasa Indonesian, Filipino translations
* Add Javascript-based example
* Increased test coverage
## Version 6.1.7 (July 14th, 2020)
* Split SMTP connection into two separate methods
* Undo BC break in PHP versions 5.2.3 - 7.0.0 introduced in 6.1.2 when injecting callables for address validation and HTML to text conversion
* Save response to SMTP welcome banner as other responses are saved
* Retry stream_select if interrupted by a signal
## Version 6.1.6 (May 27th, 2020)
* **SECURITY** Fix insufficient output escaping bug in file attachment names. CVE-2020-13625. Reported by Elar Lang of Clarified Security.
* Correct Armenian ISO language code from `am` to `hy`, add mapping for fallback
* Use correct timeout property in debug output
## Version 6.1.5 (March 14th, 2020)
* Reject invalid custom headers that are empty or contain breaks
* Various fixes for DKIM issues, especially when using `mail()` transport
* Drop the `l=` length tag from DKIM signatures; it's a mild security risk
* Ensure CRLF is used explicitly when needed, rather than `static::$LE`
* Add a method for trimming header content consistently
* Some minor tweaks to resolve static analyser complaints
* Check that attachment files are readable both when adding *and* when sending
* Work around Outlook bug in mishandling MIME preamble
* Danish translation improvements
## Version 6.1.4 (December 10th, 2019)
* Clean up hostname handling
* Avoid IDN error on older PHP versions, prep for PHP 8.0
* Don't force RFC2047 folding unnecessarily
* Enable tests on full release of PHP 7.4
## Version 6.1.3 (November 21st, 2019)
* Fix an issue preventing injected debug handlers from working
* Fix an issue relating to connection timeout
* Add `SMTP::MAX_REPLY_LENGTH` constant
* Remove some dev dependencies; phpdoc no longer included
* Fix an issue where non-compliant servers returning bare codes caused an SMTP hang
## Version 6.1.2 (November 13th, 2019)
* Substantial revision of DKIM header generation
* Use shorter hashes for auto-generated CID values
* Fix format of content-id headers, and only use them for inline attachments
* Remove all use of XHTML
* Lots of coding standards cleanup
* API docs are now auto-updated via GitHub actions
* Fix header separation bug created in 6.1.1
* Fix misidentification of background attributes in SVG images in msgHTML
## Version 6.1.1 (September 27th 2019)
* Fix misordered version tag
## Version 6.1.0 (September 27th 2019)
* Multiple bug fixes for folding of long header lines, thanks to @caugner
* Add support for [RFC2387 child element content-type hint](https://www.rfc-editor.org/rfc/rfc2387#section-3.1) in `multipart/related` structures.
* Support for Ical event methods other than `REQUEST`, thanks to @puhr-mde
* Change header folding and param separation to use spaces instead of tabs
* Use ; to separate multiple MIME header params
* Add support for RFC3461 DSN messages
* IMAP example code fixed
* Use PHP temp streams instead of temp files
* Allow for longer SMTP error codes
* Updated Brazilian Portuguese translation
* Throw exceptions on invalid encoding values
* Add Afrikaans translation, thanks to @Donno191
* Updated Farsi/Persian translation
* Add PHP 7.4 to test config
* Remove some ambiguity about setting XMailer property
* Improve error checking in mailing list example
* Drop PHP 5.5 from CI config as it's no longer supported by Travis-CI
* Fix S/MIME signing
* Add constants for encryption type
* More consistent use of constants for encryption, charset, encoding
* Add PHPMailer logo images
## Version 6.0.7 (February 1st 2019)
* Include RedHat GPL Cooperation Commitment - see the `COMMITMENT` file for details.
* Don't exclude composer.json from git exports as it breaks composer updates in projects that use PHPMailer
* Updated Malay translation
* Fix language tests
## Version 6.0.6 (November 14th 2018)
* **SECURITY** Fix potential object injection vulnerability. Reported by Sehun Oh of cyberone.kr.
* Added Tagalog translation, thanks to @StoneArtz
* Added Malagache translation, thanks to @Hackinet
* Updated Serbian translation, fixed incorrect language code, thanks to @mmilanovic4
* Updated Arabic translations (@MicroDroid)
* Updated Hungarian translations
* Updated Dutch translations
* Updated Slovenian translation (@filips123)
* Updated Slovak translation (@pcmanik)
* Updated Italian translation (@sabas)
* Updated Norwegian translation (@aleskr)
* Updated Indonesian translation (@mylastof)
* Add constants for common values, such as `text/html` and `quoted-printable`, and use them
* Added support for copied headers in DKIM, helping with debugging, and an option to add extra headers to the DKIM signature. See DKIM_sign example for how to use them. Thanks to @gwi-mmuths.
* Add Campaign Monitor transaction ID pattern matcher
* Remove deprecated constant and ini values causing warnings in PHP 7.3, added PHP 7.3 build to Travis config.
* Expanded test coverage
## Version 5.2.27 (November 14th 2018)
* **SECURITY** Fix potential object injection vulnerability. Reported by Sehun Oh of cyberone.kr.
* Note that the 5.2 branch is now deprecated and will not receive security updates after 31st December 2018.
## Version 6.0.5 (March 27th 2018)
* Re-roll of 6.0.4 to fix missed version file entry. No code changes.
## Version 6.0.4 (March 27th 2018)
* Add some modern MIME types
* Add Hindi translation (thanks to @dextel2)
* Improve composer docs
* Fix generation of path to language files
## Version 6.0.3 (January 5th 2018)
* Correct DKIM canonicalization of line breaks for header & body - thanks to @themichaelhall
* Make dependence on ext-filter explicit in composer.json
## Version 6.0.2 (November 29th 2017)
* Don't make max line length depend on line break format
* Improve Travis-CI config - thanks to Filippo Tessarotto
* Match SendGrid transaction IDs
* `idnSupported()` now static, as previously documented
* Improve error messages for invalid addresses
* Improve Indonesian translation (thanks to @januridp)
* Improve Esperanto translation (thanks to @dknacht)
* Clean up git export ignore settings for production and zip bundles
* Update license doc
* Updated upgrading docs
* Clarify `addStringEmbeddedImage` docs
* Hide auth credentials in all but lowest-level debug output, prevents leakage in bug reports
* Code style cleanup
## Version 6.0.1 (September 14th 2017)
* Use shorter Message-ID headers (with more entropy) to avoid iCloud blackhole bug
* Switch to Symfony code style (though it's not well defined)
* CI builds now apply syntax & code style checks, so make your PRs tidy!
* CI code coverage only applied on latest version of PHP to speed up builds (thanks to @Slamdunk for these CI changes)
* Remove `composer.lock` - it's important that libraries break early; keeping it is for apps
* Rename test scripts to PSR-4 spec
* Make content-id values settable on attachments, not just embedded items
* Add SMTP transaction IDs to callbacks & allow for future expansion
* Expand test coverage
## Version 6.0 (August 28th 2017)
This is a major update that breaks backwards compatibility.
* **Requires PHP 5.5 or later**
* **Uses the `PHPMailer\PHPMailer` namespace**
* File structure simplified and PSR-4 compatible, classes live in the `src/` folder
* The custom autoloader has been removed: [**use composer**](https://getcomposer.org)!
* Classes & Exceptions renamed to make use of the namespace
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks for SMTP by default:
* `PHPMailer:$LE` defaults to CRLF
* All uses of `PHPMailer::$LE` property converted to use `static::$LE` constant for consistency and ease of overriding
* Similar changes to line break handling in SMTP and POP3 classes.
* Line break format for `mail()` transport is set automatically.
* Warnings emitted for buggy `mail()` in PHP versions 7.0.0 - 7.0.16 and 7.1.0 - 7.1.2; either upgrade or switch to SMTP.
* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers, thanks to @sherryl4george
* Major cleanup of docs and examples
* All elements previously marked as deprecated have been removed:
* `PHPMailer->Version` (replaced with `VERSION` constant)
* `PHPMailer->ReturnPath`
* `PHPMailer->PluginDir`
* `PHPMailer->encodeQPphp()`
* `SMTP->CRLF` (replaced with `LE` constant)
* `SMTP->Version` (replaced with `VERSION` constant)
* `SMTP->SMTP_PORT` (replaced with `DEFAULT_PORT` constant)
* `POP3->CRLF` (replaced with `LE` constant)
* `POP3->Version` (replaced with `VERSION` constant)
* `POP3->POP3_PORT` (replaced with `DEFAULT_PORT` constant)
* `POP3->POP3_TIMEOUT` (replaced with `DEFAULT_TIMEOUT` constant)
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SingleTo` functionality is deprecated; this belongs at a higher level - PHPMailer is not a mailing list system.
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected
* `fixEOL()` method removed - it duplicates `PHPMailer::normalizeBreaks()`, so use that instead
* Don't try to use an auth mechanism if it's not supported by the server
* Reorder automatic AUTH mechanism selector to try most secure method first
* `Extras` classes have been removed - use alternative packages from [packagist.org](https://packagist.org) instead
* Better handling of automatic transfer encoding switch in the presence of long lines
* Simplification of address validation - now uses PHP's `FILTER_VALIDATE_EMAIL` pattern by default, retains advanced options
* `Debugoutput` can accept a PSR-3 logger instance
* To reduce code footprint, the examples folder is no longer included in composer deployments or GitHub zip files
* Trap low-level errors in SMTP, reports via debug output
* More reliable folding of message headers
* Inject your own SMTP implementation via `setSMTPInstance()` instead of having to subclass and override `getSMTPInstance()`.
* Make obtaining SMTP transaction ID more reliable
* Better handling of unreliable PHP timeouts
* Made `SMTPDebug = 4` slightly less noisy
## Version 5.2.25 (August 28th 2017)
* Make obtaining SMTP transaction ID more reliable
* Add Bosnian translation
* This is the last official release in the legacy PHPMailer 5.2 series; there may be future security patches (which will be found in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable)), but no further non-security PRs or issues will be accepted. Migrate to PHPMailer 6.0.
## Version 5.2.24 (July 26th 2017)
* **SECURITY** Fix XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
* Handle bare codes (an RFC contravention) in SMTP server responses
* Make message timestamps more dynamic - calculate the date separately for each message
* More thorough checks for reading attachments.
* Throw an exception when trying to send a message with an empty body caused by an internal error.
* Replaced all use of MD5 and SHA1 hash functions with SHA256.
* Now checks for invalid host strings when sending via SMTP.
* Include timestamps in HTML-format debug output
* Improve Turkish, Norwegian, Serbian, Brazilian Portuguese & simplified Chinese translations
* Correction of Serbian ISO language code from `sr` to `rs`
* Fix matching of multiple entries in `Host` to match IPv6 literals without breaking port selection (see #1094, caused by a3b4f6b)
* Better capture and reporting of SMTP connection errors
## Version 5.2.23 (March 15th 2017)
* Improve trapping of TLS errors during connection so that they don't cause warnings, and are reported better in debug output
* Amend test suite so it uses PHPUnit version 4.8, compatible with older versions of PHP, instead of the version supplied by Travis-CI
* This forces pinning of some dev packages to older releases, but should make travis builds more reliable
* Test suite now runs on HHVM, and thus so should PHPMailer in general
* Improve Czech translations
* Add links to CVE-2017-5223 resources
## Version 5.2.22 (January 5th 2017)
* **SECURITY** Fix [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223), local file disclosure vulnerability if content passed to `msgHTML()` is sourced from unfiltered user input. Reported by Yongxiang Li of Asiasecurity. The fix for this means that calls to `msgHTML()` without a `$basedir` will not import images with relative URLs, and relative URLs containing `..` will be ignored.
* Add simple contact form example
* Emoji in test content
## Version 5.2.21 (December 28th 2016)
* Fix missed number update in version file - no functional changes
## Version 5.2.20 (December 28th 2016)
* **SECURITY** Critical security update for CVE-2016-10045 please update now! Thanks to [Dawid Golunski](https://legalhackers.com) and Paul Buonopane (@Zenexer).
* Note that this change will break VERP addresses in Sender if you're using mail() - workaround: use SMTP to localhost instead.
## Version 5.2.19 (December 26th 2016)
* Minor cleanup
## Version 5.2.18 (December 24th 2016)
* **SECURITY** Critical security update for CVE-2016-10033 please update now! Thanks to [Dawid Golunski](https://legalhackers.com).
* Add ability to extract the SMTP transaction ID from some common SMTP success messages
* Minor documentation tweaks
## Version 5.2.17 (December 9th 2016)
* This is officially the last feature release of 5.2. Security fixes only from now on; use PHPMailer 6.0!
* Allow DKIM private key to be provided as a string
* Provide mechanism to allow overriding of boundary and message ID creation
* Improve Brazilian Portuguese, Spanish, Swedish, Romanian, and German translations
* PHP 7.1 support for Travis-CI
* Fix some language codes
* Add security notices
* Improve DKIM compatibility in older PHP versions
* Improve trapping and capture of SMTP connection errors
* Improve passthrough of error levels for debug output
* PHPDoc cleanup
## Version 5.2.16 (June 6th 2016)
* Added DKIM example
* Fixed empty additional_parameters problem
* Fixed wrong version number in VERSION file!
* Improve line-length tests
* Use instance settings for SMTP::connect by default
* Use more secure auth mechanisms first
## Version 5.2.15 (May 10th 2016)
* Added ability to inject custom address validators, and set the default validator
* Fix TLS 1.2 compatibility
* Remove some excess line breaks in MIME structure
* Updated Polish, Russian, Brazilian Portuguese, Georgian translations
* More DRY!
* Improve error messages
* Update dependencies
* Add example showing how to handle multiple form file uploads
* Improve SMTP example
* Improve Windows compatibility
* Use consistent names for temp files
* Fix gmail XOAUTH2 scope, thanks to @sherryl4george
* Fix extra line break in getSentMIMEMessage()
* Improve DKIM signing to use SHA-2
## Version 5.2.14 (Nov 1st 2015)
* Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon
* Allow access to POP3 errors
* Make all POP3 private properties and methods protected
* **SECURITY** Fix vulnerability that allowed email addresses with line breaks (valid in RFC5322) to pass to SMTP, permitting message injection at the SMTP level. Mitigated in both the address validator and in the lower-level SMTP class. Thanks to Takeshi Terada.
* Updated Brazilian Portuguese translations (Thanks to @phelipealves)
## Version 5.2.13 (Sep 14th 2015)
* Rename internal oauth class to avoid name clashes
* Improve Estonian translations
## Version 5.2.12 (Sep 1st 2015)
* Fix incorrect composer package dependencies
* Skip existing embedded image `cid`s in `msgHTML`
## Version 5.2.11 (Aug 31st 2015)
* Don't switch to quoted-printable for long lines if already using base64
* Fixed Travis-CI config when run on PHP 7
* Added Google XOAUTH2 authentication mechanism, thanks to @sherryl4george
* Add address parser for RFC822-format addresses
* Update MS Office MIME types
* Don't convert line breaks when using quoted-printable encoding
* Handle MS Exchange returning an invalid empty AUTH-type list in EHLO
* Don't set name or filename properties on MIME parts that don't have one
## Version 5.2.10 (May 4th 2015)
* Add custom header getter
* Use `application/javascript` for .js attachments
* Improve RFC2821 compliance for timelimits, especially for end-of-data
* Add Azerbaijani translations (Thanks to @mirjalal)
* Minor code cleanup for robustness
* Add Indonesian translations (Thanks to @ceceprawiro)
* Avoid `error_log` Debugoutput naming clash
* Add ability to parse server capabilities in response to EHLO (useful for SendGrid etc)
* Amended default values for WordWrap to match RFC
* Remove html2text converter class (has incompatible license)
* Provide new mechanism for injecting html to text converters
* Improve pointers to docs and support in README
* Add example file upload script
* Refactor and major cleanup of EasyPeasyICS, now a lot more usable
* Make set() method simpler and more reliable
* Add Malay translation (Thanks to @nawawi)
* Add Bulgarian translation (Thanks to @mialy)
* Add Armenian translation (Thanks to Hrayr Grigoryan)
* Add Slovenian translation (Thanks to Klemen Tušar)
* More efficient word wrapping
* Add support for S/MIME signing with additional CA certificate (thanks to @IgitBuh)
* Fix incorrect MIME structure when using S/MIME signing and isMail() (#372)
* Improved checks and error messages for missing extensions
* Store and report SMTP errors more consistently
* Add MIME multipart preamble for better Outlook compatibility
* Enable TLS encryption automatically if the server offers it
* Provide detailed errors when individual recipients fail
* Report more errors when connecting
* Add extras classes to composer classmap
* Expose stream_context_create options via new SMTPOptions property
* Automatic encoding switch to quoted-printable if message lines are too long
* Add Korean translation (Thanks to @ChalkPE)
* Provide a pointer to troubleshooting docs on SMTP connection failure
## Version 5.2.9 (Sept 25th 2014)
* **Important: The autoloader is no longer autoloaded by the PHPMailer class**
* Update html2text from https://github.com/mtibben/html2text
* Improve Arabic translations (Thanks to @tarekdj)
* Consistent handling of connection variables in SMTP and POP3
* PHPDoc cleanup
* Update composer to use PHPUnit 4.1
* Pass consistent params to callbacks
* More consistent handling of error states and debug output
* Use property defaults, remove constructors
* Remove unreachable code
* Use older regex validation pattern for troublesome PCRE library versions
* Improve PCRE detection in older PHP versions
* Handle debug output consistently, and always in UTF-8
* Allow user-defined debug output method via a callable
* msgHTML now converts data URIs to embedded images
* SMTP::getLastReply() will now always be populated
* Improved example code in README
* Ensure long filenames in Content-Disposition are encoded correctly
* Simplify SMTP debug output mechanism, clarify levels with constants
* Add SMTP connection check example
* Simplify examples, don't use mysql* functions
## Version 5.2.8 (May 14th 2014)
* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104
* Add timestamps to default debug output
* Add connection events and new level 3 to debug output options
* Chinese language update (Thanks to @binaryoung)
* Allow custom Mailer types (Thanks to @michield)
* Cope with spaces around SMTP host specs
* Fix processing of multiple hosts in connect string
* Added Galician translation (Thanks to @donatorouco)
* Autoloader now prepends
* Docs updates
* Add Latvian translation (Thanks to @eddsstudio)
* Add Belarusian translation (Thanks to @amaksymiuk)
* Make autoloader work better on older PHP versions
* Avoid double-encoding if mbstring is overloading mail()
* Add Portuguese translation (Thanks to @Jonadabe)
* Make quoted-printable encoder respect line ending setting
* Improve Chinese translation (Thanks to @PeterDaveHello)
* Add Georgian translation (Thanks to @akalongman)
* Add Greek translation (Thanks to @lenasterg)
* Fix serverHostname on PHP < 5.3
* Improve performance of SMTP class
* Implement automatic 7bit downgrade
* Add Vietnamese translation (Thanks to @vinades)
* Improve example images, switch to PNG
* Add Croatian translation (Thanks to @hrvoj3e)
* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong!
* Fix language file loading if CWD has changed (@stephandesouza)
* Add HTML5 email validation pattern
* Improve Turkish translations (Thanks to @yasinaydin)
* Improve Romanian translations (Thanks to @aflorea)
* Check php.ini for path to sendmail/qmail before using default
* Improve Farsi translation (Thanks to @MHM5000)
* Don't use quoted-printable encoding for multipart types
* Add Serbian translation (Thanks to ajevremovic at gmail.com)
* Remove useless PHP5 check
* Use SVG for build status badges
* Store MessageDate on creation
* Better default behaviour for validateAddress
## Version 5.2.7 (September 12th 2013)
* Add Ukrainian translation from @Krezalis
* Support for do_verp
* Fix bug in CRAM-MD5 AUTH
* Propagate Debugoutput option to SMTP class (@Reblutus)
* Determine MIME type of attachments automatically
* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it
* Add a new 'html' Debugoutput type
* Clean up SMTP debug output, remove embedded HTML
* Some small changes in header formatting to improve IETF msglint test results
* Update test_script to use some recently changed features, rename to code_generator
* Generated code actually works!
* Update SyntaxHighlighter
* Major overhaul and cleanup of example code
* New PHPMailer graphic
* msgHTML now uses RFC2392-compliant content ids
* Add line break normalization function and use it in msgHTML
* Don't set unnecessary reply-to addresses
* Make fakesendmail.sh a bit cleaner and safer
* Set a content-transfer-encoding on multiparts (fixes msglint error)
* Fix cid generation in msgHTML (Thanks to @digitalthought)
* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo)
* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid)
* Add support for iCal event alternatives (Thanks to @reblutus)
* Update to Polish language file (Thanks to Krzysztof Kowalewski)
* Update to Norwegian language file (Thanks to @datagutten)
* Update to Hungarian language file (Thanks to @dominicus-75)
* Add Persian/Farsi translation from @jaii
* Make SMTPDebug property type match type in SMTP class
* Add unit tests for DKIM
* Major refactor of SMTP class
* Reformat to PSR-2 coding standard
* Introduce autoloader
* Allow overriding of SMTP class
* Overhaul of PHPDocs
* Fix broken Q-encoding
* Czech language update (Thanks to @nemelu)
* Removal of excess blank lines in messages
* Added fake POP server and unit tests for POP-before-SMTP
## Version 5.2.6 (April 11th 2013)
* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer
* Fix unbumped version numbers
* Update packagist.org with new location
* Clean up Changelog
## Version 5.2.5 (April 6th 2013)
* First official release after move from Google Code
* Fixes for qmail when sending via mail()
* Merge in changes from Google code 5.2.4 release
* Minor coding standards cleanup in SMTP class
* Improved unit tests, now tests S/MIME signing
* Travis-CI support on GitHub, runs tests with fake SMTP server
## Version 5.2.4 (February 19, 2013)
* Fix tag and version bug.
* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail().
* Numerous translation updates
## Version 5.2.3 (February 8, 2013)
* Fix issue with older PCREs and ValidateAddress() (Bugz: 124)
* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
* Replacement of obsolete Quoted-Printable encoder with a much better implementation
* Composer package definition
* New language added: Hebrew
## Version 5.2.2 (December 3, 2012)
* Some fixes and syncs from https://github.com/Synchro/PHPMailer
* Add Slovak translation, thanks to Michal Tinka
## Version 5.2.2-rc2 (November 6, 2012)
* Fix SMTP server rotation (Bugz: 118)
* Allow override of autogen'ed 'Date' header (for Drupal's
og_mailinglist module)
* No whitespace after '-f' option (Bugz: 116)
* Work around potential warning (Bugz: 114)
## Version 5.2.2-rc1 (September 28, 2012)
* Header encoding works with long lines (Bugz: 93)
* Turkish language update (Bugz: 94)
* undefined $pattern in EncodeQ bug squashed (Bugz: 98)
* use of mail() in safe_mode now works (Bugz: 96)
* ValidateAddress() now 'public static' so people can override the
default and use their own validation scheme.
* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL
* Added in AUTH PLAIN SMTP authentication
## Version 5.2.2-beta2 (August 17, 2012)
* Fixed Postfix VERP support (Bugz: 92)
* Allow action_function callbacks to pass/use
the From address (passed as final param)
* Prevent inf look for get_lines() (Bugz: 77)
* New public var ($UseSendmailOptions). Only pass sendmail()
options iff we really are using sendmail or something sendmail
compatible. (Bugz: 75)
* default setting for LE returned to "\n" due to popular demand.
## Version 5.2.2-beta1 (July 13, 2012)
* Expose PreSend() and PostSend() as public methods to allow
for more control if serializing message sending.
* GetSentMIMEMessage() only constructs the message copy when
needed. Save memory.
* Only pass params to mail() if the underlying MTA is
"sendmail" (as defined as "having the string sendmail
in its pathname") [#69]
* Attachments now work with Amazon SES and others [Bugz#70]
* Debug output now sent to stdout (via echo) or error_log [Bugz#5]
* New var: Debugoutput (for above) [Bugz#5]
* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71]
* SMTP reads now can have a Timelimit associated with them
(new var: Timelimit=30)[Bugz#71]
* Fix quoting issue associated with charsets
* default setting for LE is now RFC compliant: "\r\n"
* Return-Path can now be user defined (new var: ReturnPath)
(the default is "" which implies no change from previous
behavior, which was to use either From or Sender) [Bugz#46]
* X-Mailer header can now be disabled (by setting to a
whitespace string, eg " ") [Bugz#66]
* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49,
#52, #31, #41, #5. #70, #69
## Version 5.2.1 (January 16, 2012)
* Closed several bugs #5
* Performance improvements
* MsgHTML() now returns the message as required.
* New method: GetSentMIMEMessage() (returns full copy of sent message)
## Version 5.2 (July 19, 2011)
* protected MIME body and header
* better DKIM DNS Resource Record support
* better aly handling
* htmlfilter class added to extras
* moved to Apache Extras
## Version 5.1 (October 20, 2009)
* fixed filename issue with AddStringAttachment (thanks to Tony)
* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
addition to PHP mail()
* added DKIM digital signing functionality, new properties:
- DKIM_domain (sets the domain name)
- DKIM_private (holds DKIM private key)
- DKIM_passphrase (holds your DKIM passphrase)
- DKIM_selector (holds the DKIM "selector")
- DKIM_identity (holds the identifying email address)
* added callback function support
- callback function parameters include:
result, to, cc, bcc, subject and body
- see the test/test_callback.php file for usage.
* added "auto" identity functionality
- can automatically add:
- Return-path (if Sender not set)
- Reply-To (if ReplyTo not set)
- can be disabled:
- $mail->SetFrom('yourname@yourdomain.com','First Last',false);
- or by adding the $mail->Sender and/or $mail->ReplyTo properties
Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers
## Version 5.0.2 (May 24, 2009)
* Fix for missing attachments when inline graphics are present
* Fix for missing Cc in header when using SMTP (mail was sent,
but not displayed in header -- Cc receiver only saw email To:
line and no Cc line, but did get the email (To receiver
saw same)
## Version 5.0.1 (April 05, 2009)
* Temporary fix for missing attachments
## Version 5.0.0 (April 02, 2009)
With the release of this version, we are initiating a new version numbering
system to differentiate from the PHP4 version of PHPMailer.
Most notable in this release is fully object oriented code.
### class.smtp.php:
* Refactored class.smtp.php to support new exception handling
* code size reduced from 29.2 Kb to 25.6 Kb
* Removed unnecessary functions from class.smtp.php:
- public function Expand($name) {
- public function Help($keyword="") {
- public function Noop() {
- public function Send($from) {
- public function SendOrMail($from) {
- public function Verify($name) {
### class.phpmailer.php:
* Refactored class.phpmailer.php with new exception handling
* Changed processing functionality of Sendmail and Qmail so they cannot be
inadvertently used
* removed getFile() function, just became a simple wrapper for
file_get_contents()
* added check for PHP version (will gracefully exit if not at least PHP 5.0)
* enhanced code to check if an attachment source is the same as an embedded or
inline graphic source to eliminate duplicate attachments
### New /test_script
We have written a test script you can use to test the script as part of your
installation. Once you press submit, the test script will send a multi-mime
email with either the message you type in or an HTML email with an inline
graphic. Two attachments are included in the email (one of the attachments
is also the inline graphic so you can see that only one copy of the graphic
is sent in the email). The test script will also display the functional
script that you can copy/paste to your editor to duplicate the functionality.
### New examples
All new examples in both basic and advanced modes. Advanced examples show
Exception handling.
### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0
All new documentation
## Version 2.3 (November 06, 2008)
* added Arabic language (many thanks to Bahjat Al Mostafa)
* removed English language from language files and made it a default within
class.phpmailer.php - if no language is found, it will default to use
the english language translation
* fixed public/private declarations
* corrected line 1728, $basedir to $directory
* added $sign_cert_file to avoid improper duplicate use of $sign_key_file
* corrected $this->Hello on line 612 to $this->Helo
* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user
if default is not acceptable
* removed trim() from return results in EncodeQP
* /test and three files it contained are removed from version 2.3
* fixed phpunit.php for compliance with PHP5
* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);
* We have removed the /phpdoc from the downloads. All documentation is now on
the http://phpmailer.codeworxtech.com website.
## Version 2.2.1 (July 19, 2008)
* fixed line 1092 in class.smtp.php (my apologies, error on my part)
## Version 2.2 (July 15, 2008)
* Fixed redirect issue (display of UTF-8 in thank you redirect)
* fixed error in getResponse function declaration (class.pop3.php)
* PHPMailer now PHP6 compliant
* fixed line 1092 in class.smtp.php (endless loop from missing = sign)
## Version 2.1 (Wed, June 04 2008)
NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED.
* added S/MIME functionality (ability to digitally sign emails)
BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
The "Signed Emails" functionality adds the Sign method to pass the private key
filename and the password to read it, and then email will be sent with
content-type multipart/signed and with the digital signature attached.
* fully compatible with E_STRICT error level
- Please note:
In about half the test environments this development version was subjected
to, an error was thrown for the date() functions used (line 1565 and 1569).
This is NOT a PHPMailer error, it is the result of an incorrectly configured
PHP5 installation. The fix is to modify your 'php.ini' file and include the
date.timezone = Etc/UTC (or your own zone)
directive, to your own server timezone
- If you do get this error, and are unable to access your php.ini file:
In your PHP script, add
`date_default_timezone_set('Etc/UTC');`
- do not try to use
`$myVar = date_default_timezone_get();`
as a test, it will throw an error.
* added ability to define path (mainly for embedded images)
function `MsgHTML($message,$basedir='')` ... where:
`$basedir` is the fully qualified path
* fixed `MsgHTML()` function:
- Embedded Images where images are specified by `<protocol>://` will not be altered or embedded
* fixed the return value of SMTP exit code ( pclose )
* addressed issue of multibyte characters in subject line and truncating
* added ability to have user specified Message ID
(default is still that PHPMailer create a unique Message ID)
* corrected unidentified message type to 'application/octet-stream'
* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).
* added check for added attachments
* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")
## Version 2.1.0beta2 (Sun, Dec 02 2007)
* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)
* finished all testing, all known bugs corrected, enhancements tested
Note: will NOT work with PHP4.
Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING**
## Version 2.1.0beta1
Please note, this is BETA software
** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
INTENDED STRICTLY FOR TESTING
## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
* implements new property to control VERP in class.smtp.php
example (requires instantiating class.smtp.php):
$mail->do_verp = true;
* POP-before-SMTP functionality included, thanks to Richard Davey
(see class.pop3.php & pop3_before_smtp_test.php for examples)
* included example showing how to use PHPMailer with GMAIL
* fixed the missing Cc in SendMail() and Mail()
## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
* dramatically simplified using inline graphics ... it's fully automated and requires no user input
* added automatic document type detection for attachments and pictures
* added MsgHTML() function to replace Body tag for HTML emails
* fixed the SendMail security issues (input validation vulnerability)
* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address
* removed the need to use the AltBody method (set from the HTML, or default text used)
* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)
* removed the need to set the IsHTML property (set automatically)
* added Estonian language file by Indrek Päri
* added header injection patch
* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc.
* fixed warning message in SMTP get_lines method
* added TLS/SSL SMTP support.
* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
* Works with PHP installed as a module or as CGI-PHP
NOTE: will NOT work with PHP5 in E_STRICT error mode
## Version 1.73 (Sun, Jun 10 2005)
* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
* Now has a total of 20 translations
* Fixed alt attachments bug: https://sourceforge.net/p/phpmailer/bugs/120/
## Version 1.72 (Wed, May 25 2004)
* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
* Received: Removed this method because spam filter programs like
SpamAssassin reject this header.
* Fixed error count bug.
* SetLanguage default is now "language/".
* Fixed magic_quotes_runtime bug.
## Version 1.71 (Tue, Jul 28 2003)
* Made several speed enhancements
* Added German and Italian translation files
* Fixed HELO/AUTH bugs on keep-alive connects
* Now provides an error message if language file does not load
* Fixed attachment EOL bug
* Updated some unclear documentation
* Added additional tests and improved others
## Version 1.70 (Mon, Jun 20 2003)
* Added SMTP keep-alive support
* Added IsError method for error detection
* Added error message translation support (SetLanguage)
* Refactored many methods to increase library performance
* Hello now sends the newer EHLO message before HELO as per RFC 2821
* Removed the boundary class and replaced it with GetBoundary
* Removed queue support methods
* New $Hostname variable
* New Message-ID header
* Received header reformat
* Helo variable default changed to $Hostname
* Removed extra spaces in Content-Type definition (#667182)
* Return-Path should be set to Sender when set
* Adds Q or B encoding to headers when necessary
* quoted-encoding should now encode NULs \000
* Fixed encoding of body/AltBody (#553370)
* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
* Multiple bug fixes
## Version 1.65 (Fri, Aug 09 2002)
* Fixed non-visible attachment bug (#585097) for Outlook
* SMTP connections are now closed after each transaction
* Fixed SMTP::Expand return value
* Converted SMTP class documentation to phpDocumentor format
## Version 1.62 (Wed, Jun 26 2002)
* Fixed multi-attach bug
* Set proper word wrapping
* Reduced memory use with attachments
* Added more debugging
* Changed documentation to phpDocumentor format
## Version 1.60 (Sat, Mar 30 2002)
* Sendmail pipe and address patch (Christian Holtje)
* Added embedded image and read confirmation support (A. Ognio)
* Added unit tests
* Added SMTP timeout support (*nix only)
* Added possibly temporary PluginDir variable for SMTP class
* Added LE message line ending variable
* Refactored boundary and attachment code
* Eliminated SMTP class warnings
* Added SendToQueue method for future queuing support
## Version 1.54 (Wed, Dec 19 2001)
* Add some queuing support code
* Fixed a pesky multi/alt bug
* Messages are no longer forced to have "To" addresses
## Version 1.50 (Thu, Nov 08 2001)
* Fix extra lines when not using SMTP mailer
* Set WordWrap variable to int with a zero default
## Version 1.47 (Tue, Oct 16 2001)
* Fixed Received header code format
* Fixed AltBody order error
* Fixed alternate port warning
## Version 1.45 (Tue, Sep 25 2001)
* Added enhanced SMTP debug support
* Added support for multiple ports on SMTP
* Added Received header for tracing
* Fixed AddStringAttachment encoding
* Fixed possible header name quote bug
* Fixed wordwrap() trim bug
* Couple other small bug fixes
## Version 1.41 (Wed, Aug 22 2001)
* Fixed AltBody bug w/o attachments
* Fixed rfc_date() for certain mail servers
## Version 1.40 (Sun, Aug 12 2001)
* Added multipart/alternative support (AltBody)
* Documentation update
* Fixed bug in Mercury MTA
## Version 1.29 (Fri, Aug 03 2001)
* Added AddStringAttachment() method
* Added SMTP authentication support
## Version 1.28 (Mon, Jul 30 2001)
* Fixed a typo in SMTP class
* Fixed header issue with Imail (win32) SMTP server
* Made fopen() calls for attachments use "rb" to fix win32 error
## Version 1.25 (Mon, Jul 02 2001)
* Added RFC 822 date fix (Patrice)
* Added improved error handling by adding a $ErrorInfo variable
* Removed MailerDebug variable (obsolete with new error handler)
## Version 1.20 (Mon, Jun 25 2001)
* Added quoted-printable encoding (Patrice)
* Set Version as public and removed PrintVersion()
* Changed phpdoc to only display public variables and methods
## Version 1.19 (Thu, Jun 21 2001)
* Fixed MS Mail header bug
* Added fix for Bcc problem with mail(). *Does not work on Win32*
(See PHP bug report: https://bugs.php.net/bug.php?id=11616
* mail() no longer passes a fifth parameter when not needed
## Version 1.15 (Fri, Jun 15 2001)
Note: these changes contributed by Patrice Fournier
* Changed all remaining \n to \r\n
* Bcc: header no longer written to message except
when sent directly to sendmail
* Added a small message to non-MIME compliant mail reader
* Added Sender variable to change the Sender email
used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
* Changed boundary setting to a place it will be set only once
* Removed transfer encoding for whole message when using multipart
* Message body now uses Encoding in multipart messages
* Can set encoding and type to attachments 7bit, 8bit
and binary attachment are sent as is, base64 are encoded
* Can set Encoding to base64 to send 8 bits body
through 7 bits servers
## Version 1.10 (Tue, Jun 12 2001)
* Fixed win32 mail header bug (printed out headers in message body)
## Version 1.09 (Fri, Jun 08 2001)
* Changed date header to work with Netscape mail programs
* Altered phpdoc documentation
## Version 1.08 (Tue, Jun 05 2001)
* Added enhanced error-checking
* Added phpdoc documentation to source
## Version 1.06 (Fri, Jun 01 2001)
* Added optional name for file attachments
## Version 1.05 (Tue, May 29 2001)
* Code cleanup
* Eliminated sendmail header warning message
* Fixed possible SMTP error
## Version 1.03 (Thu, May 24 2001)
* Fixed problem where qmail sends out duplicate messages
## Version 1.02 (Wed, May 23 2001)
* Added multiple recipient and attachment Clear* methods
* Added Sendmail public variable
* Fixed problem with loading SMTP library multiple times
## Version 0.98 (Tue, May 22 2001)
* Fixed problem with redundant mail hosts sending out multiple messages
* Added additional error handler code
* Added AddCustomHeader() function
* Added support for Microsoft mail client headers (affects priority)
* Fixed small bug with Mailer variable
* Added PrintVersion() function
## Version 0.92 (Tue, May 15 2001)
* Changed file names to class.phpmailer.php and class.smtp.php to match
current PHP class trend.
* Fixed problem where body not being printed when a message is attached
* Several small bug fixes
## Version 0.90 (Tue, April 17 2001)
* Initial public release
================================================
FILE: composer.json
================================================
{
"name": "phpmailer/phpmailer",
"type": "library",
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"funding": [
{
"url": "https://github.com/Synchro",
"type": "github"
}
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"lock": false
},
"require": {
"php": ">=5.5.0",
"ext-ctype": "*",
"ext-filter": "*",
"ext-hash": "*"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"doctrine/annotations": "^1.2.6 || ^1.13.3",
"php-parallel-lint/php-console-highlighter": "^1.0.0",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phpcompatibility/php-compatibility": "^10.0.0@dev",
"squizlabs/php_codesniffer": "^3.13.5",
"yoast/phpunit-polyfills": "^1.0.4"
},
"suggest": {
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
"ext-imap": "Needed to support advanced email address parsing according to RFC822",
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
"directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"PHPMailer\\Test\\": "test/"
}
},
"license": "LGPL-2.1-only",
"scripts": {
"check": "./vendor/bin/phpcs",
"style": "./vendor/bin/phpcbf",
"test": "./vendor/bin/phpunit --no-coverage",
"coverage": "./vendor/bin/phpunit",
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
]
}
}
================================================
FILE: docs/README.md
================================================
# PHPMailer Documentation
Generated documentation for PHPMailer is [available online](https://phpmailer.github.io/PHPMailer/), and is regenerated automatically whenever changes are made.
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).
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).
Fixes and additions to documentation are welcome - please submit pull requests or improve wiki pages.
================================================
FILE: examples/DKIM_gen_keys.phps
================================================
<?php
/**
* This shows how to make a new public/private key pair suitable for use with DKIM.
* You should only need to do this once, and the public key (**not** the private key!)
* you generate should be inserted in your DNS matching the selector you want.
*
* You can also use the DKIM wizard here: https://www.sparkpost.com/resources/tools/dkim-wizard/
* but be aware that having your private key known anywhere outside your own server
* is a security risk, and it's easy enough to create your own on your own server.
*
* For security, any keys you create should not be accessible via your web site.
*
* 2048 bits is the recommended minimum key length - gmail won't accept less than 1024 bits.
* To test your DKIM config, use Sparkpost's DKIM tester:
* https://tools.sparkpost.com/dkim
*
* Note that you only need a *private* key to *send* a DKIM-signed message,
* but receivers need your *public* key in order to verify it.
*
* Your public key will need to be formatted appropriately for your DNS and
* inserted there using the selector you want to use.
*/
//Set these to match your domain and chosen DKIM selector
$domain = 'example.com';
$selector = 'phpmailer';
//Private key filename for this selector
$privatekeyfile = $selector . '_dkim_private.pem';
//Public key filename for this selector
$publickeyfile = $selector . '_dkim_public.pem';
if (file_exists($privatekeyfile)) {
echo "Using existing keys - if you want to generate new keys, delete old key files first.\n\n";
$privatekey = file_get_contents($privatekeyfile);
$publickey = file_get_contents($publickeyfile);
} else {
//Create a 2048-bit RSA key with an SHA256 digest
$pk = openssl_pkey_new(
[
'digest_alg' => 'sha256',
'private_key_bits' => 2048,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
]
);
//Save private key
openssl_pkey_export_to_file($pk, $privatekeyfile);
//Save public key
$pubKey = openssl_pkey_get_details($pk);
$publickey = $pubKey['key'];
file_put_contents($publickeyfile, $publickey);
$privatekey = file_get_contents($privatekeyfile);
}
echo "Private key (keep this private!):\n\n" . $privatekey;
echo "\n\nPublic key:\n\n" . $publickey;
//Prepare public key for DNS, e.g.
//phpmailer._domainkey.example.com IN TXT "v=DKIM1; h=sha256; t=s; p=" "MIIBIjANBg...oXlwIDAQAB"...
$dnskey = "$selector._domainkey.$domain IN TXT";
$dnsvalue = '"v=DKIM1; h=sha256; t=s; p=" ';
//Some DNS servers don't like ;(semi colon) chars unless backslash-escaped
$dnsvalue2 = '"v=DKIM1\; h=sha256\; t=s\; p=" ';
//Strip and split the key into smaller parts and format for DNS
//Many DNS systems don't like long TXT entries
//but are OK if it's split into 255-char chunks
//Remove PEM wrapper
$publickey = preg_replace('/^-+.*?-+$/m', '', $publickey);
//Strip line breaks
$publickey = str_replace(["\r", "\n"], '', $publickey);
//Split into chunks
$keyparts = str_split($publickey, 253); //Becomes 255 when quotes are included
//Quote each chunk
foreach ($keyparts as $keypart) {
$dnsvalue .= '"' . trim($keypart) . '" ';
$dnsvalue2 .= '"' . trim($keypart) . '" ';
}
echo "\n\nDNS key:\n\n" . trim($dnskey);
echo "\n\nDNS value:\n\n" . trim($dnsvalue);
echo "\n\nDNS value (with escaping):\n\n" . trim($dnsvalue2);
================================================
FILE: examples/DKIM_sign.phps
================================================
<?php
/**
* This example shows sending a DKIM-signed message with PHPMailer.
* More info about DKIM can be found here: https://www.dkim.org/info/dkim-faq.html
* There's more to using DKIM than just this code - check out this article:
* @see https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
* See also the DKIM_gen_keys example code in the examples folder,
* which shows how to make a key pair from PHP.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Usual setup
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//This should be the same as the domain of your From address
$mail->DKIM_domain = 'example.com';
//See the DKIM_gen_keys.phps script for making a key pair -
//here we assume you've already done that.
//Path to your private key:
$mail->DKIM_private = 'dkim_private.pem';
//Set this to your own selector
$mail->DKIM_selector = 'phpmailer';
//Put your private key's passphrase in here if it has one
$mail->DKIM_passphrase = '';
//The identity you're signing as - usually your From address
$mail->DKIM_identity = $mail->From;
//Suppress listing signed header fields in signature, defaults to true for debugging purpose
$mail->DKIM_copyHeaderFields = false;
//Optionally you can add extra headers for signing to meet special requirements
$mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Help'];
//When you send, the DKIM settings will be used to sign the message
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
================================================
FILE: examples/README.md
================================================
[](https://github.com/PHPMailer/PHPMailer)
# PHPMailer code examples
This folder contains a collection of examples of using [PHPMailer](https://github.com/PHPMailer/PHPMailer).
## About testing email sending
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:
* [FakeEmail](https://github.com/tomwardill/FakeEmail), a Python-based fake mail server with a web interface.
* [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.
* [smtp4dev](https://github.com/rnwood/smtp4dev), a dummy SMTP server for Windows and Linux.
* [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.
* [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).
* [msglint](https://www.splitbrain.org/_static/msglint/), not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.
* [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.
* [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.
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!
## Security note
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!_
Similarly, don't leave your passwords in these files as they will be visible to the world!
## [mail.phps](mail.phps)
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.
## [simple_contact_form.phps](simple_contact_form.phps)
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.
## [exceptions.phps](exceptions.phps)
Like the mail example, but shows how to use PHPMailer's optional exceptions for error handling.
## [extending.phps](extending.phps)
This shows how to create a subclass of PHPMailer to customise its behaviour and simplify coding in your app.
## [smtp.phps](smtp.phps)
A simple example sending using SMTP with authentication.
## [smtp_no_auth.phps](smtp_no_auth.phps)
A simple example sending using SMTP without authentication.
## [send_file_upload.phps](send_file_upload.phps)
Lots of people want to do this... This is a simple form which accepts a file upload and emails it.
## [send_multiple_file_upload.phps](send_multiple_file_upload.phps)
A slightly more complex form that allows uploading multiple files at once and sends all of them as attachments to an email.
## [sendmail.phps](sendmail.phps)
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.
## [gmail.phps](gmail.phps)
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.
## [gmail_xoauth.phps](gmail_xoauth.phps)
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.
## [pop_before_smtp.phps](pop_before_smtp.phps)
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.
## [mailing_list.phps](mailing_list.phps)
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.
## [ssl_options.phps](ssl_options.phps)
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!
## [smime_signed_mail.phps](smime_signed_mail.phps)
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.
* * *
## [smtp_check.phps](smtp_check.phps)
This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.
## [smtp_low_memory.phps](smtp_low_memory.phps)
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.
* * *
================================================
FILE: examples/azure_xoauth2.phps
================================================
<?php
/**
* This example shows how to send via Microsoft Outlook's servers using XOAUTH2 authentication
* using the league/oauth2-client to provide the OAuth2 token.
* To use a different OAuth2 library create a wrapper class that implements OAuthTokenProvider and
* pass that wrapper class to PHPMailer::setOAuth().
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\OAuth;
//Alias the League Google OAuth2 provider class
use Greew\OAuth2\Client\Provider\Azure;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
//Load dependencies from composer
//If this causes an error, run 'composer install'
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
//SMTP::DEBUG_OFF = off (for production use)
//SMTP::DEBUG_CLIENT = client messages
//SMTP::DEBUG_SERVER = client and server messages
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
//Set the hostname of the mail server
$mail->Host = 'smtp.office365.com';
//Set the SMTP port number:
// - 465 for SMTP with implicit TLS, a.k.a. RFC8314 SMTPS or
// - 587 for SMTP+STARTTLS
$mail->Port = 587;
//Set the encryption mechanism to use:
// - SMTPS (implicit TLS on port 465) or
// - STARTTLS (explicit TLS on port 587)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Set AuthType to use XOAUTH2
$mail->AuthType = 'XOAUTH2';
//Start Option 1: Use league/oauth2-client as OAuth2 token provider
//Fill in authentication details here
//Either the microsoft account owner, or the user that gave consent
$email = 'someone@somemicrosoftaccount.com';
$clientId = 'RANDOMCHARS-----duv1n2TS';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
$tenantId = 'RANDOMCHARS-----HSFTAOIlagss';
//Obtained by configuring and running get_oauth_token.php
//after setting up an app in Google Developer Console.
$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0';
//Create a new OAuth2 provider instance
$provider = new Azure(
[
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'tenantId' => $tenantId,
]
);
//Pass the OAuth provider instance to PHPMailer
$mail->setOAuth(
new OAuth(
[
'provider' => $provider,
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'refreshToken' => $refreshToken,
'userName' => $email,
]
)
);
//End Option 1
//Option 2: Another OAuth library as OAuth2 token provider
//Set up the other oauth library as per its documentation
//Then create the wrapper class that implementations OAuthTokenProvider
$oauthTokenProvider = new MyOAuthTokenProvider(/* Email, ClientId, ClientSecret, etc. */);
//Pass the implementation of OAuthTokenProvider to PHPMailer
$mail->setOAuth($oauthTokenProvider);
//End Option 2
//Set who the message is to be sent from
//For Outlook, this generally needs to be the same as the user you logged in as
$mail->setFrom($email, 'First Last');
//Set who the message is to be sent to
$mail->addAddress('someone@someserver.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer Outlook XOAUTH2 SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->CharSet = PHPMailer::CHARSET_UTF8;
$mail->msgHTML(file_get_contents('contentsutf8.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
================================================
FILE: examples/callback.phps
================================================
<?php
/**
* This example shows how to use a callback function from PHPMailer.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
/**
* Example PHPMailer callback function.
* This is a global function, but you can also pass a closure (or any other callable)
* to the `action_function` property.
*
* @param bool $result result of the send action
* @param array $to email address of the recipient
* @param array $cc cc email addresses
* @param array $bcc bcc email addresses
* @param string $subject the subject
* @param string $body the email body
*/
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
{
echo "Message subject: \"$subject\"\n";
foreach ($to as $address) {
echo "Message to {$address[1]} <{$address[0]}>\n";
}
foreach ($cc as $address) {
echo "Message CC to {$address[1]} <{$address[0]}>\n";
}
foreach ($bcc as $toaddress) {
echo "Message BCC to {$toaddress[1]} <{$toaddress[0]}>\n";
}
if ($result) {
echo "Message sent successfully\n";
} else {
echo "Message send failed\n";
}
}
require_once '../vendor/autoload.php';
$mail = new PHPMailer();
try {
$mail->isMail();
$mail->setFrom('you@example.com', 'Your Name');
$mail->addAddress('jane@example.com', 'Jane Doe');
$mail->addCC('john@example.com', 'John Doe');
$mail->Subject = 'PHPMailer Test Subject';
$mail->msgHTML(file_get_contents('../examples/contents.html'));
//Optional - msgHTML will create an alternate automatically
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->addAttachment('images/phpmailer_mini.png');
$mail->action_function = 'callbackAction';
$mail->send();
} catch (Exception $e) {
echo $e->errorMessage();
}
//Alternative approach using a closure
try {
$mail->action_function = static function ($result, $to, $cc, $bcc, $subject, $body) {
if ($result) {
echo "Message sent successfully\n";
} else {
echo "Message send failed\n";
}
};
$mail->send();
} catch (Exception $e) {
echo $e->errorMessage();
}
================================================
FILE: examples/contactform-ajax.phps
================================================
<?php
/**
* This example shows how to handle a simple contact form safely.
*/
//Import PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
//Don't run this unless we're handling a form submission
if (array_key_exists('email', $_POST)) {
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Send using SMTP to localhost (faster and safer than using mail()) – requires a local mail server
//See other examples for how to use a remote server such as gmail
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
//Use a fixed address in your own domain as the from address
//**DO NOT** use the submitter's address here as it will be forgery
//and will cause your messages to fail SPF checks
$mail->setFrom('from@example.com', 'First Last');
//Choose who the message should be sent to
//You don't have to use a <select> like in this example, you can simply use a fixed address
//the important thing is *not* to trust an email address submitted from the form directly,
//as an attacker can substitute their own and try to use your form to send spam
$addresses = [
'sales' => 'sales@example.com',
'support' => 'support@example.com',
'accounts' => 'accounts@example.com',
];
//Validate address selection before trying to use it
if (array_key_exists('dept', $_POST) && array_key_exists($_POST['dept'], $addresses)) {
$mail->addAddress($addresses[$_POST['dept']]);
} else {
//Fall back to a fixed address if dept selection is invalid or missing
$mail->addAddress('support@example.com');
}
//Put the submitter's address in a reply-to header
//This will fail if the address provided is invalid,
//in which case we should ignore the whole request
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
$mail->Subject = 'PHPMailer contact form';
//Keep it simple - don't use HTML
$mail->isHTML(false);
//Build a simple message body
$mail->Body = <<<EOT
Email: {$_POST['email']}
Name: {$_POST['name']}
Message: {$_POST['message']}
EOT;
//Send the message, check for errors
if (!$mail->send()) {
//The reason for failing to send will be in $mail->ErrorInfo
//but it's unsafe to display errors directly to users - process the error, log it on your server.
if ($isAjax) {
http_response_code(500);
}
$response = [
"status" => false,
"message" => 'Sorry, something went wrong. Please try again later.'
];
} else {
$response = [
"status" => true,
"message" => 'Message sent! Thanks for contacting us.'
];
}
} else {
$response = [
"status" => false,
"message" => 'Invalid email address, message ignored.'
];
}
if ($isAjax) {
header('Content-type:application/json;charset=utf-8');
echo json_encode($response);
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact form</title>
</head>
<body>
<h1>Contact us</h1>
<h2 id="status-message"><?php if (isset($response)) {
echo $response['message'];
}?></h2>
<form method="POST" id="contact-form">
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
<label for="dept">Send query to department:</label>
<select name="dept" id="dept">
<option value="sales">Sales</option>
<option value="support" selected>Technical support</option>
<option value="accounts">Accounts</option>
</select><br>
<input type="submit" value="Send">
</form>
<script type="application/javascript">
const form = document.getElementById("contact-form")
function email(data) {
const message = document.getElementById("status-message")
fetch("", {
method: "POST",
body: data,
headers: {
'X-Requested-With' : 'XMLHttpRequest'
}
})
.then(response => response.json())
.then(response => {message.innerHTML = response.message})
.catch(error => {
error.json().then(response => {
message.innerHTML = response.message
})
})
}
const submitEvent = form.addEventListener("submit", (event) => {
event.preventDefault();
const formData = new FormData(form);
email(formData);
})
</script>
</body>
</html>
================================================
FILE: examples/contactform.phps
================================================
<?php
/**
* This example shows how to handle a simple contact form safely.
*/
//Import PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
$msg = '';
//Don't run this unless we're handling a form submission
if (array_key_exists('email', $_POST)) {
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Send using SMTP to localhost (faster and safer than using mail()) – requires a local mail server
//See other examples for how to use a remote server such as gmail
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
//Use a fixed address in your own domain as the from address
//**DO NOT** use the submitter's address here as it will be forgery
//and will cause your messages to fail SPF checks
$mail->setFrom('from@example.com', 'First Last');
//Choose who the message should be sent to
//You don't have to use a <select> like in this example, you can simply use a fixed address
//the important thing is *not* to trust an email address submitted from the form directly,
//as an attacker can substitute their own and try to use your form to send spam
$addresses = [
'sales' => 'sales@example.com',
'support' => 'support@example.com',
'accounts' => 'accounts@example.com',
];
//Validate address selection before trying to use it
if (array_key_exists('dept', $_POST) && array_key_exists($_POST['dept'], $addresses)) {
$mail->addAddress($addresses[$_POST['dept']]);
} else {
//Fall back to a fixed address if dept selection is invalid or missing
$mail->addAddress('support@example.com');
}
//Put the submitter's address in a reply-to header
//This will fail if the address provided is invalid,
//in which case we should ignore the whole request
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
$mail->Subject = 'PHPMailer contact form';
//Keep it simple - don't use HTML
$mail->isHTML(false);
//Build a simple message body
$mail->Body = <<<EOT
Email: {$_POST['email']}
Name: {$_POST['name']}
Message: {$_POST['message']}
EOT;
//Send the message, check for errors
if (!$mail->send()) {
//The reason for failing to send will be in $mail->ErrorInfo
//but it's unsafe to display errors directly to users - process the error, log it on your server.
$msg = 'Sorry, something went wrong. Please try again later.';
} else {
$msg = 'Message sent! Thanks for contacting us.';
}
} else {
$msg = 'Invalid email address, message ignored.';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact form</title>
</head>
<body>
<h1>Contact us</h1>
<?php if (!empty($msg)) {
echo "<h2>$msg</h2>";
} ?>
<form method="POST">
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
<label for="dept">Send query to department:</label>
<select name="dept" id="dept">
<option value="sales">Sales</option>
<option value="support" selected>Technical support</option>
<option value="accounts">Accounts</option>
</select><br>
<input type="submit" value="Send">
</form>
</body>
</html>
================================================
FILE: examples/contents.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong>.</p>
<p>ISO-8859-1 text: </p>
</div>
</body>
</html>
================================================
FILE: examples/contentsutf8.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong> with the UTF-8 Unicode charset.</p>
<p>Chinese text: 郵件內容為空</p>
<p>Russian text: Пустое тело сообщения</p>
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
<p>Czech text: Prázdné tělo zprávy</p>
<p>Emoji: <span style="font-size: 48px">😂 🦄 💥 📤 📧</span></p>
<p>Image data URL (base64)<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="#"></p>
<p>Image data URL (URL-encoded)<img src="data:image/gif,GIF89a%01%00%01%00%00%00%00%21%F9%04%01%0A%00%01%00%2C%00%00%00%00%01%00%01%00%00%02%02L%01%00%3B" alt="#"></p>
</div>
</body>
</html>
================================================
FILE: examples/exceptions.phps
================================================
<?php
/**
* This example shows how to make use of PHPMailer's exceptions for error handling.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer Exceptions test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo 'Message sent!';
} catch (Exception $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (\Exception $e) { //The leading slash means the Global PHP Exception class will be caught
echo $e->getMessage(); //Boring error messages from anything else!
}
================================================
FILE: examples/extending.phps
================================================
<?php
/**
* This example shows how to extend PHPMailer to simplify your coding.
* If PHPMailer doesn't do something the way you want it to, or your code
* contains too much boilerplate, don't edit the library files,
* create a subclass instead and customise that.
* That way all your changes will be retained when PHPMailer is updated.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
/**
* Use PHPMailer as a base class and extend it
*/
class MyPHPMailer extends PHPMailer
{
/**
* myPHPMailer constructor.
*
* @param bool|null $exceptions
* @param string $body A default HTML message body
*/
public function __construct($exceptions, $body = '')
{
//Don't forget to do this or other things may not be set correctly!
parent::__construct($exceptions);
//Set a default 'From' address
$this->setFrom('joe@example.com', 'Joe User');
//Send via SMTP
$this->isSMTP();
//Equivalent to setting `Host`, `Port` and `SMTPSecure` all at once
$this->Host = 'tls://smtp.example.com:587';
//Set an HTML and plain-text body, import relative image references
$this->msgHTML($body, './images/');
//Show debug output
$this->SMTPDebug = SMTP::DEBUG_SERVER;
//Inject a new debug output handler
$this->Debugoutput = static function ($str, $level) {
echo "Debug level $level; message: $str\n";
};
}
//Extend the send function
public function send()
{
$this->Subject = '[Yay for me!] ' . $this->Subject;
$r = parent::send();
echo 'I sent a message with subject ' . $this->Subject;
return $r;
}
}
//Now creating and sending a message becomes simpler when you use this class in your app code
try {
//Instantiate your new class, making use of the new `$body` parameter
$mail = new myPHPMailer(true, '<strong>This is the message body</strong>');
//Now you only need to set things that are different from the defaults you defined
$mail->addAddress('jane@example.com', 'Jane User');
$mail->Subject = 'Here is the subject';
$mail->addAttachment(__FILE__, 'myPHPMailer.php');
$mail->send(); //No need to check for errors - the exception handler will do it
} catch (Exception $e) {
//Note that this is catching the PHPMailer Exception class, not the global \Exception type!
echo 'Caught a ' . get_class($e) . ': ' . $e->getMessage();
}
================================================
FILE: examples/gmail.phps
================================================
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
* This uses traditional id & password authentication - look at the gmail_xoauth.phps
* example to see how to use XOAUTH2.
* The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
//SMTP::DEBUG_OFF = off (for production use)
//SMTP::DEBUG_CLIENT = client messages
//SMTP::DEBUG_SERVER = client and server messages
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Use `$mail->Host = gethostbyname('smtp.gmail.com');`
//if your network does not support SMTP over IPv6,
//though this may cause issues with TLS
//Set the SMTP port number:
// - 465 for SMTP with implicit TLS, a.k.a. RFC8314 SMTPS or
// - 587 for SMTP+STARTTLS
$mail->Port = 465;
//Set the encryption mechanism to use:
// - SMTPS (implicit TLS on port 465) or
// - STARTTLS (explicit TLS on port 587)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = 'username@gmail.com';
//Password to use for SMTP authentication
$mail->Password = 'yourpassword';
//Set who the message is to be sent from
//Note that with gmail you can only use your account address (same as `Username`)
//or predefined aliases that you have configured within your account.
//Do not use user-submitted addresses in here
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
//This is a good place to put user-submitted addresses
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
//Section 2: IMAP
//Uncomment these to save your message in the 'Sent Mail' folder.
#save_mail($mail->getSentMIMEMessage());
}
//Section 2: IMAP
//This example uses the directorytree/imapengine IMAP library: https://imapengine.com
//Earlier versions of this code used the deprecated PHP imap_* functions.
function save_mail($message)
{
$mailbox = new \DirectoryTree\ImapEngine\Mailbox([
'host' => 'imap.gmail.com',
'port' => 993,
'encryption' => 'ssl',
'username' => 'user@example.com',
'password' => 'password',
]);
// Find the "sent" messages folder – yours may have a different name.
$folder = $mailbox->folders()->find('Sent Mail');
$folder->messages()->append($message);
}
================================================
FILE: examples/gmail_xoauth.phps
================================================
<?php
/**
* This example shows how to send via Google's Gmail servers using XOAUTH2 authentication
* using the league/oauth2-client to provide the OAuth2 token.
* To use a different OAuth2 library create a wrapper class that implements OAuthTokenProvider and
* pass that wrapper class to PHPMailer::setOAuth().
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\OAuth;
//Alias the League Google OAuth2 provider class
use League\OAuth2\Client\Provider\Google;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
//Load dependencies from composer
//If this causes an error, run 'composer install'
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
//SMTP::DEBUG_OFF = off (for production use)
//SMTP::DEBUG_CLIENT = client messages
//SMTP::DEBUG_SERVER = client and server messages
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number:
// - 465 for SMTP with implicit TLS, a.k.a. RFC8314 SMTPS or
// - 587 for SMTP+STARTTLS
$mail->Port = 465;
//Set the encryption mechanism to use:
// - SMTPS (implicit TLS on port 465) or
// - STARTTLS (explicit TLS on port 587)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Set AuthType to use XOAUTH2
$mail->AuthType = 'XOAUTH2';
//Start Option 1: Use league/oauth2-client as OAuth2 token provider
//Fill in authentication details here
//Either the gmail account owner, or the user that gave consent
$email = 'someone@gmail.com';
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//Obtained by configuring and running get_oauth_token.php
//after setting up an app in Google Developer Console.
$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0';
//Create a new OAuth2 provider instance
$provider = new Google(
[
'clientId' => $clientId,
'clientSecret' => $clientSecret,
]
);
//Pass the OAuth provider instance to PHPMailer
$mail->setOAuth(
new OAuth(
[
'provider' => $provider,
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'refreshToken' => $refreshToken,
'userName' => $email,
]
)
);
//End Option 1
//Option 2: Another OAuth library as OAuth2 token provider
//Set up the other oauth library as per its documentation
//Then create the wrapper class that implements OAuthTokenProvider
$oauthTokenProvider = new MyOAuthTokenProvider(/* Email, ClientId, ClientSecret, etc. */);
//Pass the implementation of OAuthTokenProvider to PHPMailer
$mail->setOAuth($oauthTokenProvider);
//End Option 2
//Set who the message is to be sent from
//For gmail, this generally needs to be the same as the user you logged in as
$mail->setFrom($email, 'First Last');
//Set who the message is to be sent to
$mail->addAddress('someone@gmail.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail XOAUTH2 SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->CharSet = PHPMailer::CHARSET_UTF8;
$mail->msgHTML(file_get_contents('contentsutf8.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
================================================
FILE: examples/mail.phps
================================================
<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
================================================
FILE: examples/mailing_list.phps
================================================
<?php
/**
* This example shows how to send a message to a whole list of recipients efficiently.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
error_reporting(E_ALL);
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
//Passing `true` enables PHPMailer exceptions
$mail = new PHPMailer(true);
$body = file_get_contents('contents.html');
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true; //SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Port = 25;
$mail->Username = 'yourname@example.com';
$mail->Password = 'yourpassword';
$mail->setFrom('list@example.com', 'List manager');
$mail->addReplyTo('list@example.com', 'List manager');
$mail->addCustomHeader(
'List-Unsubscribe',
'<mailto:unsubscribes@example.com>, <https://www.example.com/unsubscribe.php>'
);
$mail->Subject = 'PHPMailer Simple database mailing list test';
//Same body for all messages, so set this before the sending loop
//If you generate a different body for each recipient (e.g. you're using a templating system),
//set it inside the loop
$mail->msgHTML($body);
//msgHTML also sets AltBody, but if you want a custom one, set it afterwards
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
//Connect to the database and select the recipients from your mailing list that have not yet been sent to
//You'll need to alter this to match your database
$mysql = mysqli_connect('localhost', 'username', 'password');
mysqli_select_db($mysql, 'mydb');
$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = FALSE');
foreach ($result as $row) {
try {
$mail->addAddress($row['email'], $row['full_name']);
} catch (Exception $e) {
printf(
'Invalid address skipped: %s<br>',
htmlspecialchars($row['email'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401)
);
continue;
}
if (!empty($row['photo'])) {
//Assumes the image data is stored in the DB
$mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
}
$mail->replaceCustomHeader(
'List-Unsubscribe',
'<mailto:unsubscribes@example.com>, <https://www.example.com/unsubscribe.php?email=' .
rawurlencode($row['email']) . '>'
);
try {
$mail->send();
printf(
'Message sent to : %s (%s)<br>',
htmlspecialchars($row['full_name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401),
htmlspecialchars($row['email'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401)
);
//Mark it as sent in the DB
mysqli_query(
$mysql,
"UPDATE mailinglist SET sent = TRUE WHERE email = '" .
mysqli_real_escape_string($mysql, $row['email']) . "'"
);
} catch (Exception $e) {
printf(
'Mailer Error (%s) %s<br>',
htmlspecialchars($row['email'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401),
$mail->ErrorInfo
);
//Reset the connection to abort sending this message
//The loop will continue trying to send to the rest of the list
$mail->getSMTPInstance()->reset();
}
//Clear all addresses and attachments for the next iteration
$mail->clearAddresses();
$mail->clearAttachments();
}
================================================
FILE: examples/pop_before_smtp.phps
================================================
<?php
/**
* This example shows how to use POP-before-SMTP for authentication.
* POP-before-SMTP is a very old technology that is hardly used any more.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\POP3;
use PHPMailer\PHPMailer\SMTP;
require '../vendor/autoload.php';
//Authenticate via POP3.
//After this you should be allowed to submit messages over SMTP for a few minutes.
//Only applies if your host supports POP-before-SMTP.
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
//Enable SMTP debugging
//SMTP::DEBUG_OFF = off (for production use)
//SMTP::DEBUG_CLIENT = client messages
//SMTP::DEBUG_SERVER = client and server messages
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
//Set the hostname of the mail server
$mail->Host = 'mail.example.com';
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer POP-before-SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo 'Message sent!';
} catch (Exception $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (\Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
================================================
FILE: examples/send_file_upload.phps
================================================
<?php
/**
* PHPMailer simple file upload and send example.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
//First handle the upload
//Don't trust provided filename - same goes for MIME types
//See https://www.php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
//Extract an extension from the provided filename
$ext = PHPMailer::mb_pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);
//Define a safe location to move the uploaded file to, preserving the extension
$uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'])) . '.' . $ext;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
//Upload handled successfully
//Now create a message
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
//Attach the uploaded file
if (!$mail->addAttachment($uploadfile, 'My uploaded file')) {
$msg .= 'Failed to attach file ' . $_FILES['userfile']['name'];
}
if (!$mail->send()) {
$msg .= 'Mailer Error: ' . $mail->ErrorInfo;
} else {
$msg .= 'Message sent!';
}
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
<?php } else {
echo htmlspecialchars($msg, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
} ?>
</body>
</html>
================================================
FILE: examples/send_multiple_file_upload.phps
================================================
<?php
/**
* PHPMailer multiple files upload and send example
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
//Create a message
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
//Attach multiple files one by one
for ($ct = 0, $ctMax = count($_FILES['userfile']['tmp_name']); $ct < $ctMax; $ct++) {
//Extract an extension from the provided filename
$ext = PHPMailer::mb_pathinfo($_FILES['userfile']['name'][$ct], PATHINFO_EXTENSION);
//Define a safe location to move the uploaded file to, preserving the extension
$uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'][$ct])) . '.' . $ext;
$filename = $_FILES['userfile']['name'][$ct];
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
if (!$mail->addAttachment($uploadfile, $filename)) {
$msg .= 'Failed to attach file ' . $filename;
}
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
if (!$mail->send()) {
$msg .= 'Mailer Error: ' . $mail->ErrorInfo;
} else {
$msg .= 'Message sent!';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Select one or more files:
<input name="userfile[]" type="file" multiple="multiple">
<input type="submit" value="Send Files">
</form>
<?php } else {
echo htmlspecialchars($msg, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
} ?>
</body>
</html>
================================================
FILE: examples/sendmail.phps
================================================
<?php
/**
* This example shows sending a message using a local sendmail binary.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer sendmail test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
================================================
FILE: examples/sendoauth2.phps
================================================
<?php
/**
* The SendOauth2 wrapper supports OAuth2 and Basic authorization/authentication for
* Microsoft 365 Exchange email and Google Gmail. Both TheLeague's
gitextract_zz4pddvj/
├── .codecov.yml
├── .editorconfig
├── .gitattributes
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ └── bug_report.md
│ ├── actions/
│ │ └── build-docs/
│ │ ├── Dockerfile
│ │ └── entrypoint.sh
│ ├── dependabot.yml
│ └── workflows/
│ ├── docs.yaml
│ ├── scorecards.yml
│ └── tests.yml
├── .gitignore
├── .phan/
│ └── config.php
├── COMMITMENT
├── LICENSE
├── README.md
├── SECURITY.md
├── SMTPUTF8.md
├── UPGRADING.md
├── VERSION
├── changelog.md
├── composer.json
├── docs/
│ └── README.md
├── examples/
│ ├── DKIM_gen_keys.phps
│ ├── DKIM_sign.phps
│ ├── README.md
│ ├── azure_xoauth2.phps
│ ├── callback.phps
│ ├── contactform-ajax.phps
│ ├── contactform.phps
│ ├── contents.html
│ ├── contentsutf8.html
│ ├── exceptions.phps
│ ├── extending.phps
│ ├── gmail.phps
│ ├── gmail_xoauth.phps
│ ├── images/
│ │ └── PHPMailer card logo.afdesign
│ ├── mail.phps
│ ├── mailing_list.phps
│ ├── pop_before_smtp.phps
│ ├── send_file_upload.phps
│ ├── send_multiple_file_upload.phps
│ ├── sendmail.phps
│ ├── sendoauth2.phps
│ ├── simple_contact_form.phps
│ ├── smime_signed_mail.phps
│ ├── smtp.phps
│ ├── smtp_check.phps
│ ├── smtp_low_memory.phps
│ ├── smtp_no_auth.phps
│ └── ssl_options.phps
├── get_oauth_token.php
├── language/
│ ├── phpmailer.lang-af.php
│ ├── phpmailer.lang-ar.php
│ ├── phpmailer.lang-as.php
│ ├── phpmailer.lang-az.php
│ ├── phpmailer.lang-ba.php
│ ├── phpmailer.lang-be.php
│ ├── phpmailer.lang-bg.php
│ ├── phpmailer.lang-bn.php
│ ├── phpmailer.lang-ca.php
│ ├── phpmailer.lang-cs.php
│ ├── phpmailer.lang-da.php
│ ├── phpmailer.lang-de.php
│ ├── phpmailer.lang-el.php
│ ├── phpmailer.lang-eo.php
│ ├── phpmailer.lang-es.php
│ ├── phpmailer.lang-et.php
│ ├── phpmailer.lang-fa.php
│ ├── phpmailer.lang-fi.php
│ ├── phpmailer.lang-fo.php
│ ├── phpmailer.lang-fr.php
│ ├── phpmailer.lang-gl.php
│ ├── phpmailer.lang-he.php
│ ├── phpmailer.lang-hi.php
│ ├── phpmailer.lang-hr.php
│ ├── phpmailer.lang-hu.php
│ ├── phpmailer.lang-hy.php
│ ├── phpmailer.lang-id.php
│ ├── phpmailer.lang-it.php
│ ├── phpmailer.lang-ja.php
│ ├── phpmailer.lang-ka.php
│ ├── phpmailer.lang-ko.php
│ ├── phpmailer.lang-ku.php
│ ├── phpmailer.lang-lt.php
│ ├── phpmailer.lang-lv.php
│ ├── phpmailer.lang-mg.php
│ ├── phpmailer.lang-mn.php
│ ├── phpmailer.lang-ms.php
│ ├── phpmailer.lang-nb.php
│ ├── phpmailer.lang-nl.php
│ ├── phpmailer.lang-pl.php
│ ├── phpmailer.lang-pt.php
│ ├── phpmailer.lang-pt_br.php
│ ├── phpmailer.lang-ro.php
│ ├── phpmailer.lang-ru.php
│ ├── phpmailer.lang-si.php
│ ├── phpmailer.lang-sk.php
│ ├── phpmailer.lang-sl.php
│ ├── phpmailer.lang-sr.php
│ ├── phpmailer.lang-sr_latn.php
│ ├── phpmailer.lang-sv.php
│ ├── phpmailer.lang-tl.php
│ ├── phpmailer.lang-tr.php
│ ├── phpmailer.lang-uk.php
│ ├── phpmailer.lang-ur.php
│ ├── phpmailer.lang-vi.php
│ ├── phpmailer.lang-zh.php
│ └── phpmailer.lang-zh_cn.php
├── phpcs.xml.dist
├── phpdoc.dist.xml
├── phpunit.xml.dist
├── src/
│ ├── DSNConfigurator.php
│ ├── Exception.php
│ ├── OAuth.php
│ ├── OAuthTokenProvider.php
│ ├── PHPMailer.php
│ ├── POP3.php
│ └── SMTP.php
└── test/
├── DebugLogTestListener.php
├── Fixtures/
│ ├── FileIsAccessibleTest/
│ │ ├── accessible.txt
│ │ └── inaccessible.txt
│ └── LocalizationTest/
│ ├── phpmailer.lang-fr.php
│ ├── phpmailer.lang-nl.php
│ ├── phpmailer.lang-xa_scri_cc.php
│ ├── phpmailer.lang-xb_scri.php
│ ├── phpmailer.lang-xc_cc.php
│ ├── phpmailer.lang-xd_cc.php
│ ├── phpmailer.lang-xd_scri.php
│ ├── phpmailer.lang-xe.php
│ ├── phpmailer.lang-xx.php
│ ├── phpmailer.lang-yy.php
│ ├── phpmailer.lang-yz.php
│ └── phpmailer.lang-zz.php
├── Language/
│ └── TranslationCompletenessTest.php
├── OAuth/
│ └── OAuthTest.php
├── PHPMailer/
│ ├── AddEmbeddedImageTest.php
│ ├── AddStringAttachmentTest.php
│ ├── AddStringEmbeddedImageTest.php
│ ├── AddrFormatTest.php
│ ├── AuthCRAMMD5Test.php
│ ├── CustomHeaderTest.php
│ ├── DKIMTest.php
│ ├── DKIMWithoutExceptionsTest.php
│ ├── DSNConfiguratorTest.php
│ ├── EmptyMailerTest.php
│ ├── EncodeQTest.php
│ ├── EncodeStringTest.php
│ ├── FileIsAccessibleTest.php
│ ├── FilenameToTypeTest.php
│ ├── GenerateIdTest.php
│ ├── GetLastMessageIDTest.php
│ ├── HasLineLongerThanMaxTest.php
│ ├── Html2TextTest.php
│ ├── ICalTest.php
│ ├── IsPermittedPathTest.php
│ ├── IsValidHostTest.php
│ ├── LocalizationTest.php
│ ├── MailTransportTest.php
│ ├── MbPathinfoTest.php
│ ├── MimeTypesTest.php
│ ├── NormalizeBreaksTest.php
│ ├── PHPMailerTest.php
│ ├── ParseAddressesTest.php
│ ├── PunyencodeAddressTest.php
│ ├── QuotedStringTest.php
│ ├── ReplyToGetSetClearTest.php
│ ├── SetErrorTest.php
│ ├── SetFromTest.php
│ ├── SetTest.php
│ ├── SetWordWrapTest.php
│ ├── Utf8CharBoundaryTest.php
│ ├── ValidateAddressCustomValidatorTest.php
│ ├── ValidateAddressTest.php
│ ├── WrapTextTest.php
│ └── XMailerTest.php
├── POP3/
│ └── PopBeforeSmtpTest.php
├── PreSendTestCase.php
├── Security/
│ └── DenialOfServiceVectorsTest.php
├── SendTestCase.php
├── TestCase.php
├── fakepopserver.sh
├── fakesendmail.sh
├── runfakepopserver.sh
├── testbootstrap-dist.php
└── validators.php
SYMBOL INDEX (515 symbols across 56 files)
FILE: src/DSNConfigurator.php
class DSNConfigurator (line 31) | class DSNConfigurator
method mailer (line 41) | public static function mailer($dsn, $exceptions = null)
method configure (line 60) | public function configure(PHPMailer $mailer, $dsn)
method parseDSN (line 78) | private function parseDSN($dsn)
method applyConfig (line 101) | private function applyConfig(PHPMailer $mailer, $config)
method configureSMTP (line 138) | private function configureSMTP($mailer, $config)
method configureOptions (line 173) | private function configureOptions(PHPMailer $mailer, $options)
method parseUrl (line 228) | protected function parseUrl($url)
FILE: src/Exception.php
class Exception (line 29) | class Exception extends \Exception
method errorMessage (line 36) | public function errorMessage()
FILE: src/OAuth.php
class OAuth (line 36) | class OAuth implements OAuthTokenProvider
method __construct (line 87) | public function __construct($options)
method getGrant (line 101) | protected function getGrant()
method getToken (line 111) | protected function getToken()
method getOauth64 (line 124) | public function getOauth64()
FILE: src/OAuthTokenProvider.php
type OAuthTokenProvider (line 34) | interface OAuthTokenProvider
method getOauth64 (line 43) | public function getOauth64();
FILE: src/PHPMailer.php
class PHPMailer (line 32) | class PHPMailer
method __construct (line 844) | public function __construct($exceptions = null)
method __destruct (line 856) | public function __destruct()
method mailPassthru (line 876) | private function mailPassthru($to, $subject, $body, $header, $params)
method edebug (line 911) | protected function edebug($str)
method isHTML (line 966) | public function isHTML($isHtml = true)
method isSMTP (line 978) | public function isSMTP()
method isMail (line 986) | public function isMail()
method parseSendmailPath (line 998) | private function parseSendmailPath($sendmailPath)
method isSendmail (line 1042) | public function isSendmail()
method isQmail (line 1056) | public function isQmail()
method addAddress (line 1077) | public function addAddress($address, $name = '')
method addCC (line 1092) | public function addCC($address, $name = '')
method addBCC (line 1107) | public function addBCC($address, $name = '')
method addReplyTo (line 1122) | public function addReplyTo($address, $name = '')
method addOrEnqueueAnAddress (line 1141) | protected function addOrEnqueueAnAddress($kind, $address, $name)
method setBoundaries (line 1203) | public function setBoundaries()
method addAnAddress (line 1223) | protected function addAnAddress($kind, $address, $name = '')
method parseAddresses (line 1299) | public static function parseAddresses($addrstr, $useimap = null, $char...
method parseSimplerAddresses (line 1351) | protected static function parseSimplerAddresses($addrstr, $charset)
method parseEmailString (line 1394) | private static function parseEmailString($input)
method setFrom (line 1433) | public function setFrom($address, $name = '', $auto = true)
method getLastMessageID (line 1478) | public function getLastMessageID()
method validateAddress (line 1508) | public static function validateAddress($address, $patternselect = null)
method idnSupported (line 1592) | public static function idnSupported()
method punyencodeAddress (line 1611) | public function punyencodeAddress($address)
method send (line 1661) | public function send()
method preSend (line 1687) | public function preSend()
method postSend (line 1842) | public function postSend()
method sendmailSend (line 1888) | protected function sendmailSend($header, $body)
method isShellSafe (line 2001) | protected static function isShellSafe($string)
method isPermittedPath (line 2042) | protected static function isPermittedPath($path)
method fileIsAccessible (line 2055) | protected static function fileIsAccessible($path)
method mailSend (line 2080) | protected function mailSend($header, $body)
method getSMTPInstance (line 2159) | public function getSMTPInstance()
method setSMTPInstance (line 2173) | public function setSMTPInstance(SMTP $smtp)
method setSMTPXclientAttribute (line 2188) | public function setSMTPXclientAttribute($name, $value)
method getSMTPXclientAttributes (line 2207) | public function getSMTPXclientAttributes()
method smtpSend (line 2227) | protected function smtpSend($header, $body)
method smtpConnect (line 2320) | public function smtpConnect($options = null)
method smtpClose (line 2470) | public function smtpClose()
method setLanguage (line 2490) | public static function setLanguage($langcode = 'en', $lang_path = '')
method getTranslations (line 2618) | public function getTranslations()
method addrAppend (line 2638) | public function addrAppend($type, $addr)
method addrFormat (line 2656) | public function addrFormat($addr)
method wrapText (line 2678) | public function wrapText($message, $length, $qp_mode = false)
method utf8CharBoundary (line 2778) | public function utf8CharBoundary($encodedText, $maxLength)
method setWordWrap (line 2822) | public function setWordWrap()
method createHeader (line 2846) | public function createHeader()
method getMailMIME (line 2946) | public function getMailMIME()
method getSentMIMEMessage (line 2998) | public function getSentMIMEMessage()
method generateId (line 3009) | protected function generateId()
method createBody (line 3042) | public function createBody()
method getBoundaries (line 3326) | public function getBoundaries()
method getBoundary (line 3344) | protected function getBoundary($boundary, $charSet, $contentType, $enc...
method endBoundary (line 3375) | protected function endBoundary($boundary)
method setMessageType (line 3384) | protected function setMessageType()
method headerLine (line 3411) | public function headerLine($name, $value)
method textLine (line 3423) | public function textLine($value)
method addAttachment (line 3445) | public function addAttachment(
method getAttachments (line 3498) | public function getAttachments()
method attachAll (line 3514) | protected function attachAll($disposition_type, $boundary)
method encodeFile (line 3624) | protected function encodeFile($path, $encoding = self::ENCODING_BASE64)
method encodeString (line 3659) | public function encodeString($str, $encoding = self::ENCODING_BASE64)
method encodeHeader (line 3706) | public function encodeHeader($str, $position = 'text')
method decodeHeader (line 3802) | public static function decodeHeader($value, $charset = self::CHARSET_I...
method hasMultiBytes (line 3836) | public function hasMultiBytes($str)
method has8bitChars (line 3853) | public function has8bitChars($text)
method base64EncodeWrapMB (line 3870) | public function base64EncodeWrapMB($str, $linebreak = null)
method encodeQP (line 3911) | public function encodeQP($string)
method encodeQ (line 3926) | public function encodeQ($str, $position = 'text')
method addStringAttachment (line 3984) | public function addStringAttachment(
method addEmbeddedImage (line 4047) | public function addEmbeddedImage(
method addStringEmbeddedImage (line 4117) | public function addStringEmbeddedImage(
method validateEncoding (line 4166) | protected function validateEncoding($encoding)
method cidExists (line 4188) | protected function cidExists($cid)
method inlineImageExists (line 4204) | public function inlineImageExists()
method attachmentExists (line 4220) | public function attachmentExists()
method alternativeExists (line 4236) | public function alternativeExists()
method clearQueuedAddresses (line 4246) | public function clearQueuedAddresses($kind)
method clearAddresses (line 4259) | public function clearAddresses()
method clearCCs (line 4271) | public function clearCCs()
method clearBCCs (line 4283) | public function clearBCCs()
method clearReplyTos (line 4295) | public function clearReplyTos()
method clearAllRecipients (line 4304) | public function clearAllRecipients()
method clearAttachments (line 4316) | public function clearAttachments()
method clearCustomHeaders (line 4324) | public function clearCustomHeaders()
method clearCustomHeader (line 4339) | public function clearCustomHeader($name, $value = null)
method replaceCustomHeader (line 4371) | public function replaceCustomHeader($name, $value = null)
method setError (line 4407) | protected function setError($msg)
method rfcDate (line 4433) | public static function rfcDate()
method serverHostname (line 4448) | protected function serverHostname()
method isValidHost (line 4475) | public static function isValidHost($host)
method addressHasUnicodeLocalPart (line 4505) | protected function addressHasUnicodeLocalPart($address)
method anyAddressHasUnicodeLocalPart (line 4515) | protected function anyAddressHasUnicodeLocalPart($addresses)
method needsSMTPUTF8 (line 4533) | public function needsSMTPUTF8()
method lang (line 4546) | protected static function lang($key)
method getSmtpErrorMessage (line 4573) | private function getSmtpErrorMessage($base_key)
method isError (line 4592) | public function isError()
method addCustomHeader (line 4608) | public function addCustomHeader($name, $value = null)
method getCustomHeaders (line 4634) | public function getCustomHeaders()
method msgHTML (line 4660) | public function msgHTML($message, $basedir = '', $advanced = false)
method html2text (line 4784) | public function html2text($html, $advanced = false)
method _mime_types (line 4804) | public static function _mime_types($ext = '')
method filenameToType (line 4937) | public static function filenameToType($filename)
method mb_pathinfo (line 4961) | public static function mb_pathinfo($path, $options = null)
method set (line 5011) | public function set($name, $value = '')
method secureHeader (line 5030) | public function secureHeader($str)
method normalizeBreaks (line 5045) | public static function normalizeBreaks($text, $breaktype = null)
method stripTrailingWSP (line 5067) | public static function stripTrailingWSP($text)
method stripTrailingBreaks (line 5079) | public static function stripTrailingBreaks($text)
method getLE (line 5089) | public static function getLE()
method setLE (line 5099) | protected static function setLE($le)
method sign (line 5112) | public function sign($cert_filename, $key_filename, $key_pass, $extrac...
method DKIM_QP (line 5127) | public function DKIM_QP($txt)
method DKIM_Sign (line 5152) | public function DKIM_Sign($signHeader)
method DKIM_HeaderC (line 5196) | public function DKIM_HeaderC($signHeader)
method DKIM_BodyC (line 5240) | public function DKIM_BodyC($body)
method DKIM_Add (line 5263) | public function DKIM_Add($headers_line, $subject, $body)
method hasLineLongerThanMax (line 5407) | public static function hasLineLongerThanMax($str)
method quotedString (line 5422) | public static function quotedString($str)
method getToAddresses (line 5440) | public function getToAddresses()
method getCcAddresses (line 5451) | public function getCcAddresses()
method getBccAddresses (line 5462) | public function getBccAddresses()
method getReplyToAddresses (line 5473) | public function getReplyToAddresses()
method getAllRecipientAddresses (line 5484) | public function getAllRecipientAddresses()
method doCallback (line 5501) | protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body...
method getOAuth (line 5513) | public function getOAuth()
method setOAuth (line 5521) | public function setOAuth(OAuthTokenProvider $oauth)
FILE: src/POP3.php
class POP3 (line 42) | class POP3
method popBeforeSmtp (line 173) | public static function popBeforeSmtp(
method authorise (line 200) | public function authorise($host, $port = false, $timeout = false, $use...
method connect (line 245) | public function connect($host, $port = false, $tval = 30)
method login (line 310) | public function login($username = '', $password = '')
method disconnect (line 341) | public function disconnect()
method getResponse (line 378) | protected function getResponse($size = 128)
method sendString (line 395) | protected function sendString($string)
method checkResponse (line 416) | protected function checkResponse($string)
method setError (line 433) | protected function setError($error)
method getErrors (line 450) | public function getErrors()
method catchWarning (line 463) | protected function catchWarning($errno, $errstr, $errfile, $errline)
FILE: src/SMTP.php
class SMTP (line 31) | class SMTP
method edebug (line 287) | protected function edebug($str, $level = 0)
method connect (line 348) | public function connect($host, $port = null, $timeout = 30, $options =...
method getSMTPConnection (line 407) | protected function getSMTPConnection($host, $port = null, $timeout = 3...
method startTLS (line 486) | public function startTLS()
method authenticate (line 531) | public function authenticate(
method hmac (line 702) | protected function hmac($data, $key)
method connected (line 734) | public function connected()
method close (line 761) | public function close()
method iterateLines (line 773) | private function iterateLines($s)
method data (line 805) | public function data($msg_data)
method hello (line 899) | public function hello($host = '')
method sendHello (line 925) | protected function sendHello($hello, $host)
method parseHelloFields (line 944) | protected function parseHelloFields($type)
method mail (line 1000) | public function mail($from)
method quit (line 1021) | public function quit($close_on_error = true)
method recipient (line 1045) | public function recipient($address, $dsn = '')
method xclient (line 1078) | public function xclient(array $vars)
method reset (line 1099) | public function reset()
method sendCommand (line 1113) | protected function sendCommand($command, $commandstring, $expect)
method sendAndMail (line 1187) | public function sendAndMail($from)
method verify (line 1199) | public function verify($name)
method noop (line 1210) | public function noop()
method turn (line 1224) | public function turn()
method client_send (line 1240) | public function client_send($data, $command = '')
method getError (line 1266) | public function getError()
method getServerExtList (line 1276) | public function getServerExtList()
method getServerExt (line 1298) | public function getServerExt($name)
method getLastReply (line 1326) | public function getLastReply()
method get_lines (line 1340) | protected function get_lines()
method setVerp (line 1440) | public function setVerp($enabled = false)
method getVerp (line 1450) | public function getVerp()
method setSMTPUTF8 (line 1460) | public function setSMTPUTF8($enabled = false)
method getSMTPUTF8 (line 1470) | public function getSMTPUTF8()
method setError (line 1483) | protected function setError($message, $detail = '', $smtp_code = '', $...
method setDebugOutput (line 1498) | public function setDebugOutput($method = 'echo')
method getDebugOutput (line 1508) | public function getDebugOutput()
method setDebugLevel (line 1518) | public function setDebugLevel($level = 0)
method getDebugLevel (line 1528) | public function getDebugLevel()
method setTimeout (line 1538) | public function setTimeout($timeout = 0)
method getTimeout (line 1548) | public function getTimeout()
method errorHandler (line 1561) | protected function errorHandler($errno, $errmsg, $errfile = '', $errli...
method recordLastTransactionID (line 1584) | protected function recordLastTransactionID()
method getLastTransactionID (line 1613) | public function getLastTransactionID()
FILE: test/DebugLogTestListener.php
class DebugLogTestListener (line 22) | class DebugLogTestListener implements TestListener
method add_error (line 28) | public function add_error($test, $e, $time)
method add_failure (line 33) | public function add_failure($test, $e, $time)
method start_test (line 38) | public function start_test($test)
method debugLog (line 43) | public static function debugLog($str)
FILE: test/Language/TranslationCompletenessTest.php
class TranslationCompletenessTest (line 27) | final class TranslationCompletenessTest extends TestCase
method set_up (line 39) | protected function set_up()
method testTranslations (line 48) | public function testTranslations()
FILE: test/OAuth/OAuthTest.php
class OAuthTest (line 24) | final class OAuthTest extends TestCase
method testOAuth (line 34) | public function testOAuth()
class DummyOauthProvider (line 70) | class DummyOauthProvider implements OAuthTokenProvider
method getOauth64 (line 72) | public function getOauth64()
FILE: test/PHPMailer/AddEmbeddedImageTest.php
class AddEmbeddedImageTest (line 28) | final class AddEmbeddedImageTest extends PreSendTestCase
method testAddEmbeddedImage (line 33) | public function testAddEmbeddedImage()
method testAddingImageWithoutExplicitName (line 99) | public function testAddingImageWithoutExplicitName()
method testFailToAttach (line 123) | public function testFailToAttach($path, $cid, $exceptionMessage, $name...
method testFailToAttachException (line 142) | public function testFailToAttachException(
method dataFailToAttach (line 161) | public function dataFailToAttach()
FILE: test/PHPMailer/AddStringAttachmentTest.php
class AddStringAttachmentTest (line 28) | final class AddStringAttachmentTest extends PreSendTestCase
method testAddPlainStringAttachment (line 33) | public function testAddPlainStringAttachment()
method testFailToAttach (line 100) | public function testFailToAttach($string, $filename, $exceptionMessage...
method testFailToAttachException (line 118) | public function testFailToAttachException(
method dataFailToAttach (line 136) | public function dataFailToAttach()
FILE: test/PHPMailer/AddStringEmbeddedImageTest.php
class AddStringEmbeddedImageTest (line 27) | final class AddStringEmbeddedImageTest extends PreSendTestCase
method testHtmlStringEmbedNoName (line 32) | public function testHtmlStringEmbedNoName()
method testFailToAttach (line 106) | public function testFailToAttach(
method testFailToAttachException (line 130) | public function testFailToAttachException(
method dataFailToAttach (line 149) | public function dataFailToAttach()
FILE: test/PHPMailer/AddrFormatTest.php
class AddrFormatTest (line 23) | final class AddrFormatTest extends TestCase
method testAddrFormat (line 33) | public function testAddrFormat($addr, $expected)
method dataAddrFormat (line 48) | public function dataAddrFormat()
FILE: test/PHPMailer/AuthCRAMMD5Test.php
class AuthCRAMMD5Test (line 21) | final class AuthCRAMMD5Test extends SendTestCase
method testAuthCRAMMD5 (line 27) | public function testAuthCRAMMD5()
FILE: test/PHPMailer/CustomHeaderTest.php
class CustomHeaderTest (line 23) | final class CustomHeaderTest extends TestCase
method testAddAndGetCustomHeader (line 37) | public function testAddAndGetCustomHeader($headers, $expected = null)
method dataAddAndGetCustomHeader (line 67) | public function dataAddAndGetCustomHeader()
method testAddCustomHeaderInvalid (line 163) | public function testAddCustomHeaderInvalid($name, $value = null)
method dataAddCustomHeaderInvalid (line 173) | public function dataAddCustomHeaderInvalid()
method testClearCustomHeader (line 198) | public function testClearCustomHeader()
method testClearCustomHeaderValue (line 217) | public function testClearCustomHeaderValue()
method testClearCustomHeaders (line 240) | public function testClearCustomHeaders()
method testInvalidHeaderException (line 259) | public function testInvalidHeaderException()
method testReplaceCustomHeader (line 273) | public function testReplaceCustomHeader()
FILE: test/PHPMailer/DKIMTest.php
class DKIMTest (line 24) | final class DKIMTest extends SendTestCase
method tear_down (line 38) | protected function tear_down()
method testDKIMBodyCanonicalization (line 54) | public function testDKIMBodyCanonicalization()
method testDKIMHeaderCanonicalization (line 89) | public function testDKIMHeaderCanonicalization()
method testDKIMOptionalHeaderFieldsCopy (line 126) | public function testDKIMOptionalHeaderFieldsCopy()
method testDKIMExtraHeaders (line 170) | public function testDKIMExtraHeaders()
method testDKIMSigningMail (line 216) | public function testDKIMSigningMail()
method testDKIMSignOpenSSLNotAvailableException (line 247) | public function testDKIMSignOpenSSLNotAvailableException()
FILE: test/PHPMailer/DKIMWithoutExceptionsTest.php
class DKIMWithoutExceptionsTest (line 23) | final class DKIMWithoutExceptionsTest extends TestCase
method testDKIMSignOpenSSLNotAvailable (line 37) | public function testDKIMSignOpenSSLNotAvailable()
FILE: test/PHPMailer/DSNConfiguratorTest.php
class DSNConfiguratorTest (line 27) | final class DSNConfiguratorTest extends TestCase
method testInvalidDSN (line 32) | public function testInvalidDSN()
method testInvalidScheme (line 45) | public function testInvalidScheme()
method testConfigureMail (line 58) | public function testConfigureMail()
method testConfigureSendmail (line 70) | public function testConfigureSendmail()
method testConfigureQmail (line 82) | public function testConfigureQmail()
method testConfigureSmtpWithoutAuthentication (line 94) | public function testConfigureSmtpWithoutAuthentication()
method testConfigureSmtpWithAuthentication (line 108) | public function testConfigureSmtpWithAuthentication()
method testConfigureSmtpWithoutPort (line 125) | public function testConfigureSmtpWithoutPort()
method testConfigureSmtpWitPort (line 139) | public function testConfigureSmtpWitPort()
method testConfigureSmtpsWithoutPort (line 153) | public function testConfigureSmtpsWithoutPort()
method testConfigureWithUnknownOption (line 173) | public function testConfigureWithUnknownOption()
method testConfigureWithOptions (line 186) | public function testConfigureWithOptions()
method testShortcut (line 204) | public function testShortcut()
FILE: test/PHPMailer/EmptyMailerTest.php
class EmptyMailerTest (line 23) | final class EmptyMailerTest extends TestCase
method testSendWithEmptyMailerDoesNotCrash (line 30) | public function testSendWithEmptyMailerDoesNotCrash($mailer)
method provideEmptyMailerValues (line 47) | public static function provideEmptyMailerValues()
FILE: test/PHPMailer/EncodeQTest.php
class EncodeQTest (line 24) | final class EncodeQTest extends TestCase
method testEncodeQ (line 36) | public function testEncodeQ($input, $expected, $position = null, $char...
method dataEncodeQ (line 56) | public function dataEncodeQ()
FILE: test/PHPMailer/EncodeStringTest.php
class EncodeStringTest (line 23) | final class EncodeStringTest extends TestCase
method testEncodeString (line 36) | public function testEncodeString($input, $expected, $encoding = null)
method dataEncodeString (line 52) | public function dataEncodeString()
method testInvalidEncoding (line 111) | public function testInvalidEncoding()
method testInvalidEncodingException (line 127) | public function testInvalidEncodingException()
FILE: test/PHPMailer/FileIsAccessibleTest.php
class FileIsAccessibleTest (line 29) | final class FileIsAccessibleTest extends TestCase
method testFileIsAccessible (line 39) | public function testFileIsAccessible($input, $expected)
method dataFileIsAccessible (line 54) | public function dataFileIsAccessible()
method testFileIsAccessibleFailsOnUnreadableFile (line 82) | public function testFileIsAccessibleFailsOnUnreadableFile()
FILE: test/PHPMailer/FilenameToTypeTest.php
class FilenameToTypeTest (line 24) | final class FilenameToTypeTest extends TestCase
method testFilenameToType (line 34) | public function testFilenameToType($filename, $expected)
method dataFilenameToType (line 45) | public function dataFilenameToType()
FILE: test/PHPMailer/GenerateIdTest.php
class GenerateIdTest (line 24) | final class GenerateIdTest extends PreSendTestCase
method testGenerateID (line 39) | public function testGenerateID()
method testBoundaries (line 68) | public function testBoundaries()
FILE: test/PHPMailer/GetLastMessageIDTest.php
class GetLastMessageIDTest (line 24) | final class GetLastMessageIDTest extends PreSendTestCase
method testMessageIDInvalid (line 33) | public function testMessageIDInvalid($id)
method dataMessageIDInvalid (line 48) | public function dataMessageIDInvalid()
method testMessageIDValid (line 74) | public function testMessageIDValid($id)
method dataMessageIDValid (line 89) | public function dataMessageIDValid()
method testMessageIDEmpty (line 101) | public function testMessageIDEmpty()
FILE: test/PHPMailer/HasLineLongerThanMaxTest.php
class HasLineLongerThanMaxTest (line 22) | final class HasLineLongerThanMaxTest extends PreSendTestCase
method testLongBody (line 29) | public function testLongBody()
method testLongBodySmime (line 64) | public function testLongBodySmime()
method testShortBody (line 104) | public function testShortBody()
method testLineLength (line 133) | public function testLineLength()
FILE: test/PHPMailer/Html2TextTest.php
class Html2TextTest (line 24) | final class Html2TextTest extends TestCase
method testHtml2Text (line 35) | public function testHtml2Text($input, $expected, $charset = null)
method dataHtml2Text (line 50) | public function dataHtml2Text()
method testHtml2TextAdvanced (line 159) | public function testHtml2TextAdvanced($input, $callback, $expected)
method dataHtml2TextAdvanced (line 175) | public function dataHtml2TextAdvanced()
method methodBasedCallback (line 227) | public static function methodBasedCallback($html)
FILE: test/PHPMailer/ICalTest.php
class ICalTest (line 21) | final class ICalTest extends PreSendTestCase
method testICalMethod (line 32) | public function testICalMethod($methodLine, $expected)
method dataICalMethod (line 79) | public function dataICalMethod()
FILE: test/PHPMailer/IsPermittedPathTest.php
class IsPermittedPathTest (line 25) | final class IsPermittedPathTest extends TestCase
method testIsPermittedPath (line 35) | public function testIsPermittedPath($input, $expected)
method dataIsPermittedPath (line 50) | public function dataIsPermittedPath()
FILE: test/PHPMailer/IsValidHostTest.php
class IsValidHostTest (line 24) | final class IsValidHostTest extends TestCase
method testValidHost (line 33) | public function testValidHost($input)
method dataValidHost (line 43) | public function dataValidHost()
method testInvalidHost (line 69) | public function testInvalidHost($input)
method dataInvalidHost (line 79) | public function dataInvalidHost()
FILE: test/PHPMailer/LocalizationTest.php
class LocalizationTest (line 33) | final class LocalizationTest extends TestCase
method testSetLanguageSuccess (line 44) | public function testSetLanguageSuccess($phrase, $langCode = null, $lan...
method dataSetLanguageSuccess (line 71) | public function dataSetLanguageSuccess()
method testSetLanguageSuccessFallBackLogic (line 134) | public function testSetLanguageSuccessFallBackLogic($phrase, $langCode...
method dataSetLanguageSuccessFallBackLogic (line 144) | public function dataSetLanguageSuccessFallBackLogic()
method testSetLanguageFail (line 199) | public function testSetLanguageFail($langCode = null, $langPath = null)
method dataSetLanguageFail (line 231) | public function dataSetLanguageFail()
method testSetLanguageDoesNotExecuteCodeInLangFile (line 282) | public function testSetLanguageDoesNotExecuteCodeInLangFile()
method testSetLanguageDoesNotExecuteCodeWithBackticksInLangFile (line 327) | public function testSetLanguageDoesNotExecuteCodeWithBackticksInLangFi...
method testSetLanguageOnlyProcessesKnownKeys (line 358) | public function testSetLanguageOnlyProcessesKnownKeys()
method testGetTranslations (line 407) | public function testGetTranslations($langCode = null)
method dataGetTranslations (line 423) | public function dataGetTranslations()
method testLang (line 444) | public function testLang($input, $expected, $langCode = null)
method dataLang (line 463) | public function dataLang()
FILE: test/PHPMailer/MailTransportTest.php
class MailTransportTest (line 21) | final class MailTransportTest extends SendTestCase
method set_up (line 26) | protected function set_up()
method tear_down (line 34) | protected function tear_down()
method testSendmailSend (line 45) | public function testSendmailSend()
method testQmailSend (line 62) | public function testQmailSend()
method testMailSend (line 83) | public function testMailSend()
method testMailSendWithSendmailParams (line 129) | public function testMailSendWithSendmailParams()
method testSendmailSendWithSendmailParams (line 159) | public function testSendmailSendWithSendmailParams()
method testParseSendmailPath (line 189) | public function testParseSendmailPath($sendmailPath, $expectedCommand,...
method sendmailPathProvider (line 216) | public function sendmailPathProvider()
FILE: test/PHPMailer/MbPathinfoTest.php
class MbPathinfoTest (line 24) | final class MbPathinfoTest extends TestCase
method testMb_pathinfoWithoutOptions (line 34) | public function testMb_pathinfoWithoutOptions($path, $expected)
method dataMb_pathinfoWithoutOptions (line 45) | public function dataMb_pathinfoWithoutOptions()
method testMb_pathinfoWithOptions (line 122) | public function testMb_pathinfoWithOptions($options, $expected)
method dataMb_pathinfoWithOptions (line 134) | public function dataMb_pathinfoWithOptions()
FILE: test/PHPMailer/MimeTypesTest.php
class MimeTypesTest (line 24) | final class MimeTypesTest extends TestCase
method testMime_Types (line 34) | public function testMime_Types($input, $expected)
method dataMime_Types (line 45) | public function dataMime_Types()
FILE: test/PHPMailer/NormalizeBreaksTest.php
class NormalizeBreaksTest (line 25) | final class NormalizeBreaksTest extends TestCase
method testNormalizeBreaks (line 36) | public function testNormalizeBreaks($input, $expected, $breaktype = null)
method dataNormalizeBreaks (line 47) | public function dataNormalizeBreaks()
method testNormalizeBreaksWithCustomLineEnding (line 94) | public function testNormalizeBreaksWithCustomLineEnding()
FILE: test/PHPMailer/PHPMailerTest.php
class PHPMailerTest (line 24) | final class PHPMailerTest extends SendTestCase
method testLowPriority (line 31) | public function testLowPriority()
method testMultiplePlainFileAttachment (line 45) | public function testMultiplePlainFileAttachment()
method testRejectNonLocalFileAttachment (line 69) | public function testRejectNonLocalFileAttachment()
method testQuotedPrintable (line 85) | public function testQuotedPrintable()
method testHeaderEncoding (line 115) | public function testHeaderEncoding()
method testHtml (line 195) | public function testHtml()
method testDsn (line 224) | public function testDsn()
method testCreateBody (line 251) | public function testCreateBody()
method testHtmlIso8859 (line 284) | public function testHtmlIso8859()
method testHtmlUtf8 (line 312) | public function testHtmlUtf8()
method testUtf8WithEmbeddedImage (line 342) | public function testUtf8WithEmbeddedImage()
method testPlainUtf8 (line 378) | public function testPlainUtf8()
method testMsgHTML (line 399) | public function testMsgHTML()
method testHTMLAttachment (line 456) | public function testHTMLAttachment()
method testAttachmentNaming (line 503) | public function testAttachmentNaming()
method testHTMLMultiAttachment (line 563) | public function testHTMLMultiAttachment()
method testEmbeddedImage (line 598) | public function testEmbeddedImage()
method testEmbeddedImageCustomCidDomain (line 622) | public function testEmbeddedImageCustomCidDomain()
method testMultiEmbeddedImage (line 648) | public function testMultiEmbeddedImage()
method testAltBody (line 683) | public function testAltBody()
method testAltBodyAttachment (line 700) | public function testAltBodyAttachment()
method testMultipleSend (line 723) | public function testMultipleSend()
method testEmptyBody (line 740) | public function testEmptyBody()
method testSmtpKeepAlive (line 755) | public function testSmtpKeepAlive()
method testAddressing (line 773) | public function testAddressing()
method testAddressEscaping (line 799) | public function testAddressEscaping()
method testMIMEStructure (line 829) | public function testMIMEStructure()
method testBCCAddressing (line 846) | public function testBCCAddressing()
method testAddAttachmentEncodingException (line 862) | public function testAddAttachmentEncodingException()
method testAddFolderAsAttachment (line 873) | public function testAddFolderAsAttachment()
method testDeletedAttachmentException (line 887) | public function testDeletedAttachmentException()
method testDeletedAttachmentError (line 902) | public function testDeletedAttachmentError()
method testBase64 (line 915) | public function testBase64()
method testSigning (line 928) | public function testSigning()
method testSigningWithCA (line 986) | public function testSigningWithCA()
method testLineBreaks (line 1066) | public function testLineBreaks()
method testMiscellaneous (line 1094) | public function testMiscellaneous()
method testBadSMTP (line 1107) | public function testBadSMTP()
method testConfirmReadingTo (line 1117) | public function testConfirmReadingTo()
method testConvertEncoding (line 1150) | public function testConvertEncoding()
method testDuplicateIDNRemoved (line 1195) | public function testDuplicateIDNRemoved()
method testUnsupportedSmtpUTF8 (line 1227) | public function testUnsupportedSmtpUTF8()
method testStrangeUnicodeEmailAddresses (line 1236) | public function testStrangeUnicodeEmailAddresses()
method testAutomaticEaiValidation (line 1249) | public function testAutomaticEaiValidation()
method testSmtpUTF8 (line 1263) | public function testSmtpUTF8()
method testSmtpXclient (line 1311) | public function testSmtpXclient()
method testSmtpConnect (line 1343) | public function testSmtpConnect()
method testGivenIdnAddress_addAddress_returns_true (line 1379) | public function testGivenIdnAddress_addAddress_returns_true()
method testErroneousAddress_addAddress_returns_false (line 1384) | public function testErroneousAddress_addAddress_returns_false()
FILE: test/PHPMailer/ParseAddressesTest.php
class ParseAddressesTest (line 23) | final class ParseAddressesTest extends TestCase
method verifyExpectations (line 33) | protected function verifyExpectations($actual, $expected)
method testAddressSplittingNative (line 53) | public function testAddressSplittingNative($addrstr, $expected, $chars...
method dataAddressSplittingNative (line 80) | public function dataAddressSplittingNative()
method testParseEmailString (line 107) | public function testParseEmailString($addrstr, $expected)
method dataParseEmailString (line 121) | public function dataParseEmailString()
method testAddressSplitting (line 160) | public function testAddressSplitting($addrstr, $expected)
method dataAddressSplitting (line 173) | public function dataAddressSplitting()
method testDecodeHeader (line 272) | public function testDecodeHeader($str, $expected)
method dataDecodeHeader (line 285) | public function dataDecodeHeader()
FILE: test/PHPMailer/PunyencodeAddressTest.php
class PunyencodeAddressTest (line 24) | final class PunyencodeAddressTest extends TestCase
method testPunyencodeAddressConversion (line 38) | public function testPunyencodeAddressConversion($input, $charset, $exp...
method dataPunyencodeAddressConversion (line 54) | public function dataPunyencodeAddressConversion()
method testPunyencodeAddressNoConversion (line 92) | public function testPunyencodeAddressNoConversion($input, $charset, $e...
method dataPunyencodeAddressNoConversion (line 111) | public function dataPunyencodeAddressNoConversion()
FILE: test/PHPMailer/QuotedStringTest.php
class QuotedStringTest (line 24) | final class QuotedStringTest extends TestCase
method testQuotedString (line 34) | public function testQuotedString($input, $expected)
method dataQuotedString (line 45) | public function dataQuotedString()
FILE: test/PHPMailer/ReplyToGetSetClearTest.php
class ReplyToGetSetClearTest (line 23) | final class ReplyToGetSetClearTest extends PreSendTestCase
method testAddReplyToValidAddressNonIdn (line 40) | public function testAddReplyToValidAddressNonIdn($address, $name = nul...
method dataAddReplyToValidAddressNonIdn (line 86) | public function dataAddReplyToValidAddressNonIdn()
method testAddReplyToInvalidAddressNonIdn (line 125) | public function testAddReplyToInvalidAddressNonIdn($address)
method testAddReplyToInvalidAddressNonIdnException (line 147) | public function testAddReplyToInvalidAddressNonIdnException($address)
method dataAddReplyToInvalidAddressNonIdn (line 161) | public function dataAddReplyToInvalidAddressNonIdn()
method testReplyToInMessageHeader (line 181) | public function testReplyToInMessageHeader($addresses, $expected)
method dataReplyToInMessageHeader (line 207) | public function dataReplyToInMessageHeader()
method testEnqueueAndAddIdnAddress (line 265) | public function testEnqueueAndAddIdnAddress()
method testNoDuplicateReplyToAddresses (line 305) | public function testNoDuplicateReplyToAddresses()
method testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions (line 402) | public function testAddReplyToFailsOn8BitCharInDomainWithoutOptionalEx...
method testClearReplyTos (line 419) | public function testClearReplyTos()
FILE: test/PHPMailer/SetErrorTest.php
class SetErrorTest (line 25) | final class SetErrorTest extends TestCase
method testSetErrorNonSmtp (line 30) | public function testSetErrorNonSmtp()
method testSetErrorNonSmtpWithMailerSmtp (line 48) | public function testSetErrorNonSmtpWithMailerSmtp()
method testSetErrorNonSmtpWithSmtpInstanceSet (line 58) | public function testSetErrorNonSmtpWithSmtpInstanceSet()
method testSetErrorSmtp (line 74) | public function testSetErrorSmtp($mockReturn, $expected)
method dataSetErrorSmtp (line 95) | public function dataSetErrorSmtp()
method testErrorInfoOnlyContainsLastError (line 132) | public function testErrorInfoOnlyContainsLastError()
method testIsErrorWithoutError (line 150) | public function testIsErrorWithoutError()
FILE: test/PHPMailer/SetFromTest.php
class SetFromTest (line 25) | final class SetFromTest extends TestCase
method testSetFromSuccess (line 36) | public function testSetFromSuccess($expected, $address, $name = '')
method dataSetFromSuccess (line 51) | public function dataSetFromSuccess()
method testSetFromDoesNotOverruleSenderWithAutoFalse (line 106) | public function testSetFromDoesNotOverruleSenderWithAutoFalse()
method testSetFromDoesNotOverruleExistingSender (line 117) | public function testSetFromDoesNotOverruleExistingSender()
method testSetFromFail (line 136) | public function testSetFromFail($address, $name = '')
method testInvalidAddressException (line 159) | public function testInvalidAddressException($address, $name = '')
method dataSetFromFail (line 173) | public function dataSetFromFail()
method testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions (line 194) | public function testSetFromFailsOn8BitCharInDomainWithoutOptionalExten...
FILE: test/PHPMailer/SetTest.php
class SetTest (line 23) | final class SetTest extends TestCase
method testSetValidProperty (line 33) | public function testSetValidProperty($name, $value)
method dataSetValidProperty (line 43) | public function dataSetValidProperty()
method testTogglingPropertyValueAwayFromNull (line 61) | public function testTogglingPropertyValueAwayFromNull()
method testSetInvalidProperty (line 70) | public function testSetInvalidProperty()
FILE: test/PHPMailer/SetWordWrapTest.php
class SetWordWrapTest (line 24) | final class SetWordWrapTest extends PreSendTestCase
method testWordWrap (line 35) | public function testWordWrap($wrapAt, $message, $subjectSuffix)
method dataWordWrap (line 71) | public function dataWordWrap()
method testNoWordWrap (line 94) | public function testNoWordWrap()
FILE: test/PHPMailer/Utf8CharBoundaryTest.php
class Utf8CharBoundaryTest (line 25) | final class Utf8CharBoundaryTest extends TestCase
method testUtf8CharBoundary (line 36) | public function testUtf8CharBoundary($encodedText, $maxLength, $expected)
method dataUtf8CharBoundary (line 46) | public function dataUtf8CharBoundary()
FILE: test/PHPMailer/ValidateAddressCustomValidatorTest.php
class ValidateAddressCustomValidatorTest (line 24) | final class ValidateAddressCustomValidatorTest extends TestCase
method testOneOffCustomValidator (line 29) | public function testOneOffCustomValidator()
method testSetDefaultValidatorToCustom (line 48) | public function testSetDefaultValidatorToCustom()
method testRejectCallables (line 87) | public function testRejectCallables($callback, $message)
method dataRejectCallables (line 99) | public function dataRejectCallables()
FILE: test/PHPMailer/ValidateAddressTest.php
class ValidateAddressTest (line 32) | final class ValidateAddressTest extends TestCase
method set_up_before_class (line 37) | public static function set_up_before_class()
method tear_down_after_class (line 46) | public static function tear_down_after_class()
method testPatternsValidAddress (line 58) | public function testPatternsValidAddress($pattern)
method testPatternsInvalidAddress (line 73) | public function testPatternsInvalidAddress($pattern)
method dataPatterns (line 86) | public function dataPatterns()
method testValidAddresses (line 109) | public function testValidAddresses($emailAddress)
method dataValidAddresses (line 119) | public function dataValidAddresses()
method dataAsciiAddresses (line 204) | public function dataAsciiAddresses()
method dataValidIPv6 (line 222) | public function dataValidIPv6()
method testInvalidAddresses (line 267) | public function testInvalidAddresses($emailAddress)
method dataInvalidAddresses (line 279) | public function dataInvalidAddresses()
method dataUnicodeAddresses (line 433) | public function dataUnicodeAddresses()
method dataInvalidPHPPattern (line 452) | public function dataInvalidPHPPattern()
method arrayToNamedDataProvider (line 476) | protected function arrayToNamedDataProvider($items, $prefix = '')
FILE: test/PHPMailer/WrapTextTest.php
class WrapTextTest (line 24) | final class WrapTextTest extends TestCase
method testWrapText (line 36) | public function testWrapText($message, $expected, $qp_mode = false, $l...
method dataWrapText (line 46) | public function dataWrapText()
FILE: test/PHPMailer/XMailerTest.php
class XMailerTest (line 24) | final class XMailerTest extends TestCase
method testXMailer (line 34) | public function testXMailer($xmailer, $expected)
method dataXMailer (line 50) | public function dataXMailer()
FILE: test/POP3/PopBeforeSmtpTest.php
class PopBeforeSmtpTest (line 26) | final class PopBeforeSmtpTest extends TestCase
method set_up_before_class (line 38) | public static function set_up_before_class()
method set_up (line 52) | protected function set_up()
method tear_down (line 66) | protected function tear_down()
method testPopBeforeSmtpGood (line 77) | public function testPopBeforeSmtpGood()
method testPopBeforeSmtpBad (line 104) | public function testPopBeforeSmtpBad()
method testPopBeforeSmtpUnreachable (line 131) | public function testPopBeforeSmtpUnreachable()
FILE: test/PreSendTestCase.php
class PreSendTestCase (line 22) | abstract class PreSendTestCase extends TestCase
FILE: test/Security/DenialOfServiceVectorsTest.php
class DenialOfServiceVectorsTest (line 23) | final class DenialOfServiceVectorsTest extends SendTestCase
method testDenialOfServiceAttack1 (line 28) | public function testDenialOfServiceAttack1()
method testDenialOfServiceAttack2 (line 45) | public function testDenialOfServiceAttack2()
FILE: test/SendTestCase.php
class SendTestCase (line 21) | abstract class SendTestCase extends PreSendTestCase
method set_up (line 43) | protected function set_up()
FILE: test/TestCase.php
class TestCase (line 25) | abstract class TestCase extends PolyfillTestCase
method set_up_before_class (line 128) | public static function set_up_before_class()
method set_up (line 142) | protected function set_up()
method tear_down (line 176) | protected function tear_down()
method resetStaticProperties (line 190) | protected function resetStaticProperties()
method updateStaticProperty (line 211) | public static function updateStaticProperty($className, $propertyName,...
method buildBody (line 234) | protected function buildBody()
method checkChanges (line 311) | protected function checkChanges()
method addChange (line 353) | protected function addChange($sName, $sNewValue)
method addNote (line 363) | protected function addNote($sValue)
method setAddress (line 377) | protected function setAddress($sAddress, $sName = '', $sType = 'to')
FILE: test/validators.php
function php (line 4) | function php()
function phpx (line 9) | function phpx()
Condensed preview — 186 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (968K chars).
[
{
"path": ".codecov.yml",
"chars": 342,
"preview": "codecov:\n notify:\n after_n_builds: 2\n\ncoverage:\n round: nearest\n # Status will be green when coverage is between 7"
},
{
"path": ".editorconfig",
"chars": 220,
"preview": "root = true\n\n[*]\ncharset = utf-8\nindent_size = 4\nindent_style = space\nend_of_line = lf\ninsert_final_newline = true\ntrim_"
},
{
"path": ".gitattributes",
"chars": 415,
"preview": "* text=auto\n\n/.codecov.yml export-ignore\n/.editorconfig export-ignore\n/.gitattributes export-ignore\n/.github export-igno"
},
{
"path": ".github/FUNDING.yml",
"chars": 174,
"preview": "# These are supported funding model platforms\n\ngithub: Synchro\npatreon: marcusbointon\ntidelift: \"packagist/phpmailer/php"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 1030,
"preview": "---\nname: Bug report\nabout: If you've found a bug in PHPMailer, this is the right place to report it\ntitle: ''\nlabels: '"
},
{
"path": ".github/actions/build-docs/Dockerfile",
"chars": 433,
"preview": "FROM phpdoc/phpdoc\n\nLABEL \"repository\"=\"https://github.com/PHPMailer/PHPMailer\"\n\nLABEL \"com.github.actions.name\"=\"Build "
},
{
"path": ".github/actions/build-docs/entrypoint.sh",
"chars": 43,
"preview": "#!/bin/sh\n\nset -eu\n\n/opt/phpdoc/bin/phpdoc\n"
},
{
"path": ".github/dependabot.yml",
"chars": 607,
"preview": "# Dependabot configuration.\n#\n# Please see the documentation for all configuration options:\n# https://docs.github.com/gi"
},
{
"path": ".github/workflows/docs.yaml",
"chars": 862,
"preview": "name: Docs\non:\n push:\n branches:\n - master\npermissions: {}\njobs:\n build_and_publish:\n permissions:\n co"
},
{
"path": ".github/workflows/scorecards.yml",
"chars": 2338,
"preview": "name: Scorecards supply-chain security\non:\n # Only the default branch is supported.\n branch_protection_rule:\n schedul"
},
{
"path": ".github/workflows/tests.yml",
"chars": 8753,
"preview": "name: \"Tests\"\n\non:\n push:\n pull_request:\n # Allow manually triggering the workflow.\n workflow_dispatch:\n\npermissions"
},
{
"path": ".gitignore",
"chars": 263,
"preview": "docs/*\n!docs/README.md\ntest/message.txt\ntest/testbootstrap.php\nbuild/\nvendor/\n*.pem\ncomposer.lock\n.phpcs.xml\nphpcs.xml\n."
},
{
"path": ".phan/config.php",
"chars": 1328,
"preview": "<?php\n\n/**\n * This configuration will be read and overlaid on top of the\n * default configuration. Command line argument"
},
{
"path": "COMMITMENT",
"chars": 2092,
"preview": "GPL Cooperation Commitment\nVersion 1.0\n\nBefore filing or continuing to prosecute any legal proceeding or claim\n(other th"
},
{
"path": "LICENSE",
"chars": 26529,
"preview": " GNU LESSER GENERAL PUBLIC LICENSE\n Version 2.1, February 1999\n\n Copyright (C) 19"
},
{
"path": "README.md",
"chars": 16820,
"preview": "[](https://supportuk"
},
{
"path": "SECURITY.md",
"chars": 7585,
"preview": "# Security notices relating to PHPMailer\n\nPlease disclose any security issues or vulnerabilities found through [Tidelift"
},
{
"path": "SMTPUTF8.md",
"chars": 5905,
"preview": "# A short history of UTF-8 in email\n\n## Background\n\nFor most of its existence, SMTP has been a 7-bit channel, only suppo"
},
{
"path": "UPGRADING.md",
"chars": 5438,
"preview": "# Upgrading from PHPMailer 5.2 to 6.0\n\nPHPMailer 6.0 is a major update, breaking backward compatibility.\n\nIf you're in d"
},
{
"path": "VERSION",
"chars": 6,
"preview": "7.0.2\n"
},
{
"path": "changelog.md",
"chars": 55012,
"preview": "# PHPMailer Change Log\n\n## Version 7.0.2 (January 9th, 2026)\n* Fixes for sendmail parameter problems in WordPress, thank"
},
{
"path": "composer.json",
"chars": 3016,
"preview": "{\n \"name\": \"phpmailer/phpmailer\",\n \"type\": \"library\",\n \"description\": \"PHPMailer is a full-featured email creat"
},
{
"path": "docs/README.md",
"chars": 994,
"preview": "# PHPMailer Documentation\n\nGenerated documentation for PHPMailer is [available online](https://phpmailer.github.io/PHPMa"
},
{
"path": "examples/DKIM_gen_keys.phps",
"chars": 3317,
"preview": "<?php\n\n/**\n * This shows how to make a new public/private key pair suitable for use with DKIM.\n * You should only need t"
},
{
"path": "examples/DKIM_sign.phps",
"chars": 1769,
"preview": "<?php\n\n/**\n * This example shows sending a DKIM-signed message with PHPMailer.\n * More info about DKIM can be found here"
},
{
"path": "examples/README.md",
"chars": 8289,
"preview": "[](https://github.com/PHPMailer/PHPMailer)\n# PHPMailer code examples\n\nThis folder"
},
{
"path": "examples/azure_xoauth2.phps",
"chars": 4050,
"preview": "<?php\n\n/**\n * This example shows how to send via Microsoft Outlook's servers using XOAUTH2 authentication\n * using the l"
},
{
"path": "examples/callback.phps",
"chars": 2291,
"preview": "<?php\n\n/**\n * This example shows how to use a callback function from PHPMailer.\n */\n\n//Import PHPMailer classes into the"
},
{
"path": "examples/contactform-ajax.phps",
"chars": 5113,
"preview": "<?php\n\n/**\n * This example shows how to handle a simple contact form safely.\n */\n\n//Import PHPMailer class into the glob"
},
{
"path": "examples/contactform.phps",
"chars": 3595,
"preview": "<?php\n\n/**\n * This example shows how to handle a simple contact form safely.\n */\n\n//Import PHPMailer class into the glob"
},
{
"path": "examples/contents.html",
"chars": 559,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n <ti"
},
{
"path": "examples/contentsutf8.html",
"chars": 1085,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <title>P"
},
{
"path": "examples/exceptions.phps",
"chars": 1659,
"preview": "<?php\n\n/**\n * This example shows how to make use of PHPMailer's exceptions for error handling.\n */\n\n//Import PHPMailer c"
},
{
"path": "examples/extending.phps",
"chars": 2618,
"preview": "<?php\n\n/**\n * This example shows how to extend PHPMailer to simplify your coding.\n * If PHPMailer doesn't do something t"
},
{
"path": "examples/gmail.phps",
"chars": 3446,
"preview": "<?php\n\n/**\n * This example shows settings to use when sending via Google's Gmail servers.\n * This uses traditional id & "
},
{
"path": "examples/gmail_xoauth.phps",
"chars": 3881,
"preview": "<?php\n\n/**\n * This example shows how to send via Google's Gmail servers using XOAUTH2 authentication\n * using the league"
},
{
"path": "examples/mail.phps",
"chars": 1145,
"preview": "<?php\n\n/**\n * This example shows sending a message using PHP's mail() function.\n */\n\n//Import the PHPMailer class into t"
},
{
"path": "examples/mailing_list.phps",
"chars": 3466,
"preview": "<?php\n\n/**\n * This example shows how to send a message to a whole list of recipients efficiently.\n */\n\n//Import the PHPM"
},
{
"path": "examples/pop_before_smtp.phps",
"chars": 2429,
"preview": "<?php\n\n/**\n * This example shows how to use POP-before-SMTP for authentication.\n * POP-before-SMTP is a very old technol"
},
{
"path": "examples/send_file_upload.phps",
"chars": 2123,
"preview": "<?php\n\n/**\n * PHPMailer simple file upload and send example.\n */\n\n//Import the PHPMailer class into the global namespace"
},
{
"path": "examples/send_multiple_file_upload.phps",
"chars": 2072,
"preview": "<?php\n\n/**\n * PHPMailer multiple files upload and send example\n */\n\n//Import the PHPMailer class into the global namespa"
},
{
"path": "examples/sendmail.phps",
"chars": 1216,
"preview": "<?php\n\n/**\n * This example shows sending a message using a local sendmail binary.\n */\n\n//Import the PHPMailer class into"
},
{
"path": "examples/sendoauth2.phps",
"chars": 5561,
"preview": "<?php\n\n/**\n * The SendOauth2 wrapper supports OAuth2 and Basic authorization/authentication for\n * Microsoft 365 Exchang"
},
{
"path": "examples/simple_contact_form.phps",
"chars": 3873,
"preview": "<?php\n\n/**\n * PHPMailer simple contact form example.\n * If you want to accept and send uploads in your form, look at the"
},
{
"path": "examples/smime_signed_mail.phps",
"chars": 4285,
"preview": "<?php\n\n/**\n * This PHPMailer example shows S/MIME signing a message and then sending.\n *\n * Before you can sign the mail"
},
{
"path": "examples/smtp.phps",
"chars": 2246,
"preview": "<?php\n\n/**\n * This example shows making an SMTP connection with authentication.\n */\n\n//Import the PHPMailer class into t"
},
{
"path": "examples/smtp_check.phps",
"chars": 2062,
"preview": "<?php\n\n/**\n * This uses the SMTP class alone to check that a connection can be made to an SMTP server,\n * authenticate, "
},
{
"path": "examples/smtp_low_memory.phps",
"chars": 4931,
"preview": "<?php\n\n/**\n * SMTP low memory example.\n */\n\nuse PHPMailer\\PHPMailer\\PHPMailer;\nuse PHPMailer\\PHPMailer\\SMTP;\n\n/**\n * Thi"
},
{
"path": "examples/smtp_no_auth.phps",
"chars": 1865,
"preview": "<?php\n\n/**\n * This example shows making an SMTP connection without using authentication.\n */\n\n//Import the PHPMailer cla"
},
{
"path": "examples/ssl_options.phps",
"chars": 2332,
"preview": "<?php\n\n/**\n * This example shows settings to use when sending over SMTP with TLS and custom connection options.\n */\n\n//I"
},
{
"path": "get_oauth_token.php",
"chars": 6304,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email creation and transport class.\n * PHP Version 5.5\n * @package PHPMailer\n * @see https"
},
{
"path": "language/phpmailer.lang-af.php",
"chars": 1581,
"preview": "<?php\n\n/**\n * Afrikaans PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-ar.php",
"chars": 1616,
"preview": "<?php\n\n/**\n * Arabic PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-as.php",
"chars": 2386,
"preview": "<?php\n\n/**\n * Assamese PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-az.php",
"chars": 1662,
"preview": "<?php\n\n/**\n * Azerbaijani PHPMailer language file: refer to English translation for definitive list\n * @package PHPMaile"
},
{
"path": "language/phpmailer.lang-ba.php",
"chars": 1727,
"preview": "<?php\n\n/**\n * Bosnian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-be.php",
"chars": 1693,
"preview": "<?php\n\n/**\n * Belarusian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer"
},
{
"path": "language/phpmailer.lang-bg.php",
"chars": 1705,
"preview": "<?php\n\n/**\n * Bulgarian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-bn.php",
"chars": 2401,
"preview": "<?php\n\n/**\n * Bengali PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-ca.php",
"chars": 1703,
"preview": "<?php\n\n/**\n * Catalan PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-cs.php",
"chars": 1739,
"preview": "<?php\n\n/**\n * Czech PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n */\n"
},
{
"path": "language/phpmailer.lang-da.php",
"chars": 2739,
"preview": "<?php\n\n/**\n * Danish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-de.php",
"chars": 1877,
"preview": "<?php\n\n/**\n * German PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n */"
},
{
"path": "language/phpmailer.lang-el.php",
"chars": 2452,
"preview": "<?php\n\n/**\n * Greek PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n */\n"
},
{
"path": "language/phpmailer.lang-eo.php",
"chars": 2745,
"preview": "<?php\n\n/**\n * Esperanto PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-es.php",
"chars": 2808,
"preview": "<?php\n\n/**\n * Spanish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-et.php",
"chars": 1720,
"preview": "<?php\n\n/**\n * Estonian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-fa.php",
"chars": 1671,
"preview": "<?php\n\n/**\n * Persian/Farsi PHPMailer language file: refer to English translation for definitive list\n * @package PHPMai"
},
{
"path": "language/phpmailer.lang-fi.php",
"chars": 1644,
"preview": "<?php\n\n/**\n * Finnish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-fo.php",
"chars": 1615,
"preview": "<?php\n\n/**\n * Faroese PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-fr.php",
"chars": 2639,
"preview": "<?php\n\n/**\n * French PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-gl.php",
"chars": 1730,
"preview": "<?php\n\n/**\n * Galician PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-he.php",
"chars": 1505,
"preview": "<?php\n\n/**\n * Hebrew PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-hi.php",
"chars": 2426,
"preview": "<?php\n\n/**\n * Hindi PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * @"
},
{
"path": "language/phpmailer.lang-hr.php",
"chars": 1736,
"preview": "<?php\n\n/**\n * Croatian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-hu.php",
"chars": 1658,
"preview": "<?php\n\n/**\n * Hungarian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-hy.php",
"chars": 1693,
"preview": "<?php\n\n/**\n * Armenian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-id.php",
"chars": 1997,
"preview": "<?php\n\n/**\n * Indonesian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer"
},
{
"path": "language/phpmailer.lang-it.php",
"chars": 1817,
"preview": "<?php\n\n/**\n * Italian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-ja.php",
"chars": 2090,
"preview": "<?php\n\n/**\n * Japanese PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-ka.php",
"chars": 1768,
"preview": "<?php\n\n/**\n * Georgian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-ko.php",
"chars": 1369,
"preview": "<?php\n\n/**\n * Korean PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-ku.php",
"chars": 1717,
"preview": "<?php\n\n/**\n * Kurdish (Sorani) PHPMailer language file: refer to English translation for definitive list\n * @package PHP"
},
{
"path": "language/phpmailer.lang-lt.php",
"chars": 1610,
"preview": "<?php\n\n/**\n * Lithuanian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer"
},
{
"path": "language/phpmailer.lang-lv.php",
"chars": 1588,
"preview": "<?php\n\n/**\n * Latvian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-mg.php",
"chars": 1782,
"preview": "<?php\n\n/**\n * Malagasy PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-mn.php",
"chars": 1669,
"preview": "<?php\n\n/**\n * Mongolian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-ms.php",
"chars": 1734,
"preview": "<?php\n\n/**\n * Malaysian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-nb.php",
"chars": 2680,
"preview": "<?php\n\n/**\n * Norwegian Bokmål PHPMailer language file: refer to English translation for definitive list\n * @package PHP"
},
{
"path": "language/phpmailer.lang-nl.php",
"chars": 2799,
"preview": "<?php\n\n/**\n * Dutch PHPMailer language file: refer to PHPMailer.php for definitive list.\n * @package PHPMailer\n * @autho"
},
{
"path": "language/phpmailer.lang-pl.php",
"chars": 2583,
"preview": "<?php\n\n/**\n * Polish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n */"
},
{
"path": "language/phpmailer.lang-pt.php",
"chars": 2423,
"preview": "<?php\n\n/**\n * Portuguese (European) PHPMailer language file: refer to English translation for definitive list\n * @packag"
},
{
"path": "language/phpmailer.lang-pt_br.php",
"chars": 2677,
"preview": "<?php\n\n/**\n * Brazilian Portuguese PHPMailer language file: refer to English translation for definitive list\n * @package"
},
{
"path": "language/phpmailer.lang-ro.php",
"chars": 2410,
"preview": "<?php\n\n/**\n * Romanian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n "
},
{
"path": "language/phpmailer.lang-ru.php",
"chars": 2515,
"preview": "<?php\n\n/**\n * Russian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-si.php",
"chars": 2293,
"preview": "<?php\n\n/**\n * Sinhalese PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-sk.php",
"chars": 1859,
"preview": "<?php\n\n/**\n * Slovak PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * "
},
{
"path": "language/phpmailer.lang-sl.php",
"chars": 2547,
"preview": "<?php\n\n/**\n * Slovene PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-sr.php",
"chars": 1765,
"preview": "<?php\n\n/**\n * Serbian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-sr_latn.php",
"chars": 1772,
"preview": "<?php\n\n/**\n * Serbian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-sv.php",
"chars": 1594,
"preview": "<?php\n\n/**\n * Swedish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-tl.php",
"chars": 1721,
"preview": "<?php\n\n/**\n * Tagalog PHPMailer language file: refer to English translation for definitive list\n *\n * @package PHPMail"
},
{
"path": "language/phpmailer.lang-tr.php",
"chars": 2924,
"preview": "<?php\n\n/**\n * Turkish PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n *"
},
{
"path": "language/phpmailer.lang-uk.php",
"chars": 1765,
"preview": "<?php\n\n/**\n * Ukrainian PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n"
},
{
"path": "language/phpmailer.lang-ur.php",
"chars": 1808,
"preview": "<?php\n\n/**\n * Urdu PHPMailer language file: refer to English translation for definitive list\n * @package PHPMailer\n * @a"
},
{
"path": "language/phpmailer.lang-vi.php",
"chars": 1603,
"preview": "<?php\n\n/**\n * Vietnamese (Tiếng Việt) PHPMailer language file: refer to English translation for definitive list.\n * @pac"
},
{
"path": "language/phpmailer.lang-zh.php",
"chars": 1353,
"preview": "<?php\n\n/**\n * Traditional Chinese PHPMailer language file: refer to English translation for definitive list\n * @package "
},
{
"path": "language/phpmailer.lang-zh_cn.php",
"chars": 1825,
"preview": "<?php\n\n/**\n * Simplified Chinese PHPMailer language file: refer to English translation for definitive list\n * @package P"
},
{
"path": "phpcs.xml.dist",
"chars": 1994,
"preview": "<?xml version=\"1.0\"?>\n<ruleset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:noNamespaceSchemaLocat"
},
{
"path": "phpdoc.dist.xml",
"chars": 451,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<phpdoc>\n <title>PHPMailer</title>\n <parser>\n <target>docs</target>"
},
{
"path": "phpunit.xml.dist",
"chars": 1179,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:noName"
},
{
"path": "src/DSNConfigurator.php",
"chars": 6883,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email creation and transport class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPM"
},
{
"path": "src/Exception.php",
"chars": 1256,
"preview": "<?php\n\n/**\n * PHPMailer Exception class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPMailer/PHPMailer/ Th"
},
{
"path": "src/OAuth.php",
"chars": 3791,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email creation and transport class.\n * PHP Version 5.5.\n *\n * @see https://github.co"
},
{
"path": "src/OAuthTokenProvider.php",
"chars": 1538,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email creation and transport class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPM"
},
{
"path": "src/PHPMailer.php",
"chars": 194053,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email creation and transport class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPM"
},
{
"path": "src/POP3.php",
"chars": 12452,
"preview": "<?php\n\n/**\n * PHPMailer POP-Before-SMTP Authentication Class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPMaile"
},
{
"path": "src/SMTP.php",
"chars": 53628,
"preview": "<?php\n\n/**\n * PHPMailer RFC821 SMTP email transport class.\n * PHP Version 5.5.\n *\n * @see https://github.com/PHPMa"
},
{
"path": "test/DebugLogTestListener.php",
"chars": 1069,
"preview": "<?php\n\n/**\n * PHPMailer - language file tests.\n *\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer@synchro"
},
{
"path": "test/Fixtures/FileIsAccessibleTest/accessible.txt",
"chars": 13,
"preview": "Testing 1-2-3"
},
{
"path": "test/Fixtures/FileIsAccessibleTest/inaccessible.txt",
"chars": 13,
"preview": "Testing 1-2-3"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-fr.php",
"chars": 256,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test overruling an existing translation\n *"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-nl.php",
"chars": 256,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test overruling an existing translation\n *"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xa_scri_cc.php",
"chars": 181,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xb_scri.php",
"chars": 173,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xc_cc.php",
"chars": 174,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xd_cc.php",
"chars": 174,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xd_scri.php",
"chars": 173,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xe.php",
"chars": 166,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test the fall-back logic.\n */\n\n$PHPMAILER_"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-xx.php",
"chars": 184,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest`.\n */\n\n$PHPMAILER_LANG['empty_message'] = 'Thi"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-yy.php",
"chars": 535,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test that arbitrary code in translation fi"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-yz.php",
"chars": 630,
"preview": "<?php // lint < 8.5.\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test that arbitrary code in"
},
{
"path": "test/Fixtures/LocalizationTest/phpmailer.lang-zz.php",
"chars": 847,
"preview": "<?php\n\n/**\n * Test fixture.\n *\n * Used in the `PHPMailer\\LocalizationTest` to test that language strings not\n * set via "
},
{
"path": "test/Language/TranslationCompletenessTest.php",
"chars": 3300,
"preview": "<?php\n\n/**\n * PHPMailer - language file tests.\n *\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer@synchro"
},
{
"path": "test/OAuth/OAuthTest.php",
"chars": 2496,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/AddEmbeddedImageTest.php",
"chars": 6442,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/AddStringAttachmentTest.php",
"chars": 5181,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/AddStringEmbeddedImageTest.php",
"chars": 5520,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/AddrFormatTest.php",
"chars": 2075,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/AuthCRAMMD5Test.php",
"chars": 1545,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/CustomHeaderTest.php",
"chars": 9149,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/DKIMTest.php",
"chars": 9063,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/DKIMWithoutExceptionsTest.php",
"chars": 1186,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/DSNConfiguratorTest.php",
"chars": 6439,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/EmptyMailerTest.php",
"chars": 1330,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/EncodeQTest.php",
"chars": 3962,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/EncodeStringTest.php",
"chars": 4572,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/FileIsAccessibleTest.php",
"chars": 3428,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/FilenameToTypeTest.php",
"chars": 2217,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/GenerateIdTest.php",
"chars": 2630,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/GetLastMessageIDTest.php",
"chars": 3310,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/HasLineLongerThanMaxTest.php",
"chars": 6373,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/Html2TextTest.php",
"chars": 9733,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/ICalTest.php",
"chars": 4309,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/IsPermittedPathTest.php",
"chars": 3796,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/IsValidHostTest.php",
"chars": 4188,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/LocalizationTest.php",
"chars": 19519,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/MailTransportTest.php",
"chars": 8710,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/MbPathinfoTest.php",
"chars": 5587,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/MimeTypesTest.php",
"chars": 1925,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/NormalizeBreaksTest.php",
"chars": 3613,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/PHPMailerTest.php",
"chars": 51273,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/ParseAddressesTest.php",
"chars": 13136,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/PunyencodeAddressTest.php",
"chars": 4757,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/QuotedStringTest.php",
"chars": 2081,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/ReplyToGetSetClearTest.php",
"chars": 16804,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/SetErrorTest.php",
"chars": 5181,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/SetFromTest.php",
"chars": 7062,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/SetTest.php",
"chars": 2314,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/SetWordWrapTest.php",
"chars": 3842,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/Utf8CharBoundaryTest.php",
"chars": 1948,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/ValidateAddressCustomValidatorTest.php",
"chars": 3634,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/ValidateAddressTest.php",
"chars": 17069,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/WrapTextTest.php",
"chars": 6089,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PHPMailer/XMailerTest.php",
"chars": 1987,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/POP3/PopBeforeSmtpTest.php",
"chars": 3756,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/PreSendTestCase.php",
"chars": 1415,
"preview": "<?php\n\n/**\n * PHPMailer - Base test class.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer@synchromedia.c"
},
{
"path": "test/Security/DenialOfServiceVectorsTest.php",
"chars": 1598,
"preview": "<?php\n\n/**\n * PHPMailer - PHP email transport unit tests.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer"
},
{
"path": "test/SendTestCase.php",
"chars": 4330,
"preview": "<?php\n\n/**\n * PHPMailer - Base test class.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer@synchromedia.c"
},
{
"path": "test/TestCase.php",
"chars": 12361,
"preview": "<?php\n\n/**\n * PHPMailer - Base test class.\n * PHP version 5.5.\n *\n * @author Marcus Bointon <phpmailer@synchromedia.c"
},
{
"path": "test/fakepopserver.sh",
"chars": 3060,
"preview": "#!/usr/bin/env bash\n\n# Fake POP3 server\n# By Marcus Bointon <phpmailer@synchromedia.co.uk>\n# Copyright 2010 - 2020 Marcu"
},
{
"path": "test/fakesendmail.sh",
"chars": 496,
"preview": "#!/usr/bin/env bash\n#Fake sendmail script, adapted from:\n#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce"
},
{
"path": "test/runfakepopserver.sh",
"chars": 295,
"preview": "#!/usr/bin/env bash\n\nset -xv\n\n# Run the fake pop server from bash\n# Defaults to port 1100 so it can be run by unpriv use"
},
{
"path": "test/testbootstrap-dist.php",
"chars": 240,
"preview": "<?php\n\n$_REQUEST['submitted'] = 1;\n$_REQUEST['mail_to'] = 'somebody@example.com';\n$_REQUEST['mail_from'] = 'phpunit@exam"
},
{
"path": "test/validators.php",
"chars": 169,
"preview": "<?php\n\n//These are global functions without a namespace used for testing validator injection\nfunction php()\n{\n return"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the PHPMailer/PHPMailer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 186 files (907.5 KB), approximately 237.4k tokens, and a symbol index with 515 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.