PHPMailer does not work with LocalWP

Issue Summary

I can not send emails anymore, after switching from XAMPP (Windows) to LocalWP (macOS arm64).

I have been using XAMPP for years now and did the following:

  • Installed PHPMailer via Composer

  • Configured PHPMailer with the following settings

    function configure_smtp(PHPMailer\PHPMailer\PHPMailer $phpmailer)
    {
    $phpmailer->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
    $phpmailer->Debugoutput = function($str, $level) {echo “debug level $level; message: $str”;};
    $phpmailer->isSMTP(); // Set mailer to use SMTP
    $phpmailer->Host = ‘HOSTNAME’; // Specify main and backup SMTP servers
    $phpmailer->SMTPAuth = true; // Enable SMTP authentication
    $phpmailer->Username = ‘USERNAME’; // SMTP username
    $phpmailer->Password = ‘PASSWORD’; // SMTP password
    $phpmailer->SMTPSecure = ‘tls’; // Enable TLS encryption, ssl also accepted
    $phpmailer->Port = 587; // TCP port to connect to
    $phpmailer->CharSet = ‘UTF-8’;
    $phpmailer->setFrom(“info@mymail.com”, ‘My Name’);
    $phpmailer->addReplyTo(“info@mymail.com”, ‘My Name’);
    }

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    All sites

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

System Details

  • Which version of Local is being used?

  • What Operating System (OS) and OS version is being used?

    • For example: macOS Catalina or Windows 10 Professional

macOS 12.2.1 M1 CPU

Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.