Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via composer

phpmailer/phpmailer v6.9.1

PHPMailer is a full-featured email creation and transfer class for PHP
Package summary
Share
1
issue
1
moderate severity
license
1
1
license
1
LGPL-2.1-only
Package created
3 Dec 2012
Version published
25 Nov 2023
Maintainers
1
Total deps
1
Direct deps
0
License
LGPL-2.1-only

Issues

1

1 moderate severity issue

moderate
Recommendation: Validate that the package complies with your license policy
via: phpmailer/phpmailer@v6.9.1
Collapse
Expand

Licenses

GNU Lesser General Public License v2.1 only

Weakly Protective
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
sublicense
Must
include-original
include-copyright
include-license
disclose-source
state-changes
include-notice
1 Packages, Including:
phpmailer/phpmailer@v6.9.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of phpmailer/phpmailer 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does phpmailer/phpmailer do?

PHPMailer is a highly popular, full-featured email creation and transfer class for PHP. Used by a long list of open-source projects, PHPMailer provides integrated SMTP support, the ability to send emails with multiple To, CC, BCC, and Reply-to addresses, Multipart/Alternative emails, support for UTF-8 content, automatic validation of email addresses, protection against header injection attacks, DKIM and S/MIME signing support, and much more. Its comprehensive feature set makes it a preferred choice among PHP developers for sending emails from their code.

How do you use phpmailer/phpmailer?

To use PHPMailer, you first need to install it. The recommended way to install PHPMailer is via Composer. Here is a code snippet showing how to do this:

composer require phpmailer/phpmailer

Once installed, you can use PHPMailer to send emails. Here's a basic example:

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);

try {
    $mail->SMTPDebug = SMTP::DEBUG_SERVER;
    $mail->isSMTP();
    $mail->Host       = 'smtp.example.com';
    $mail->SMTPAuth   = true;
    $mail->Username   = 'user@example.com';
    $mail->Password   = 'secret';
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
    $mail->Port       = 465;

    $mail->setFrom('from@example.com', 'Mailer');
    $mail->addAddress('joe@example.net', 'Joe User');

    $mail->isHTML(true);
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

In this example, an SMTP server is used to send the email. To, From, Subject, and Body fields of the email are set using the relevant PHPMailer methods.

Where are the phpmailer/phpmailer docs?

You can find extensive documentation for PHPMailer on its GitHub wiki. It includes a wide array of information, from basic usage to troubleshooting guides, API documentation, and examples. Detailed API-level documentation can be generated by running phpdoc in the top-level folder.

In addition, you'll find many examples in the examples folder on the GitHub repository. Before you ask a question about "SMTP Error: Could not connect to SMTP host.", make sure to check out the troubleshooting guide as it's frequently updated. The GitHub wiki is the best place to start if you want to learn more about PHPMailer.