Skip to content

Instantly share code, notes, and snippets.

@seebeen
Created July 2, 2021 10:15
Show Gist options
  • Save seebeen/76b65141b9c4cbe2e834af56e03180c6 to your computer and use it in GitHub Desktop.
Save seebeen/76b65141b9c4cbe2e834af56e03180c6 to your computer and use it in GitHub Desktop.
WordPress PHPMailer SMTP
<?php
namespace Extremis\Core;
use PHPMailer\PHPMailer\PHPMailer;
class SMTP
{
public function __construct()
{
add_action('phpmailer_init', [$this, 'configureSMTP']);
}
public function configureSMTP(PHPMailer $phpmailer)
{
$phpmailer->isSMTP();
$phpmailer->Host = 'server.hostname.ili.ip';
$phpmailer->Port = '587';
$phpmailer->SMTPSecure = true;
$phpmailer->SMTPAuth = true;
$phpmailer->Username = '[email protected]';
$phpmailer->Password = 'sifra_za_email';
$phpmailer->From = '[email protected]';
$phpmailer->FromName = 'Ime sa kog se salje';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment