Search code examples
phpphpmailer

Any lightweight alternatives to PHPMailer?


We have an old version of PhpMailer using class.phpmailer.php on shared hosting and need to upgrade to a secure version. It looks like version 6 needs SSH access to install via composer, however version 5.2.26 includes PHPMailerAutoload.php so can this version be simply uploaded and then include PHPMailerAutoload.php or must this version also be installed with composer? The json file for v5.2.26 shows 18 dependancies!

Or is there a lighter weight free alternative to PHPMailer?

UPDATE1: Reading here it seems there is a minimal install option with simple example for version 5.2.stable (currently 5.2.26) if using reduced functionality or specifically including required libraries.

UPDATE2: I'm testing a minimal install using the latest version 6 using:

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

require 'PHPMailer-6/src/Exception.php';
require 'PHPMailer-6/src/PHPMailer.php';
require 'PHPMailer-6/src/SMTP.php';

$mail = new PHPMailer;
$mail->IsHTML(true);

Solution

  • It would probably help if you read the readme which tells you how to deal with this under "Installation and loading". Composer does not require SSH access on your server; you can simply run it locally and upload the vendor folder like you do all your other scripts.

    As standard, PHPMailer has no dependencies unless you want to use XOAUTH2, and no new ones have been introduced in 6.0.