Website Email Authentication for Contact Forms & More

Starting Wednesday, July 15, 2026, all unauthenticated email will be rejected, to reduce spam and phishing.

Email sent from a website (e.g. contact forms, orders, etc.) must authenticate using an email account in cPanel -> Email section -> Email Accounts.

 

WordPress

Install and configure a WordPress plugin, such as GoSMTP, WP Mail SMTP, etc.

 

PHPMailer

Update existing PHP code using PHPMailer to authenticate when sending email through the website.

Here is sample PHP code to authenticate when sending with PHPMailer:

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

// Download copy of PHPMailer from GitHub (https://github.com/PHPMailer/PHPMailer)
// Upload PHPMailer to your hosting service
// Update paths below to your copy of PHPMailer
require '/home/cpanelusername/PHPMailer/src/Exception.php';
require '/home/cpanelusername/PHPMailer/src/PHPMailer.php';
require '/home/cpanelusername/PHPMailer/src/SMTP.php';

$mail = new PHPMailer(true);

try {
    // Server settings
    $mail->isSMTP();                                      // Use SMTP
    $mail->Host       = 'mail.example.com';               // SMTP server
    $mail->Port       = 465;                              // Port for SSL
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;      // Use SSL encryption
    $mail->SMTPAuth   = true;                             // Enable authentication
    $mail->Username   = 'your_email@example.com';         // SMTP username
    $mail->Password   = 'your_password';                  // SMTP password

    // Optional: handle self-signed certificates
    $mail->SMTPOptions = [
        'ssl' => [
            'verify_peer'       => false,
            'verify_peer_name'  => false,
            'allow_self_signed' => true
        ]
    ];

    // Sender & recipient
    $mail->setFrom('your_email@example.com', 'Your Name');
    $mail->addAddress('recipient@example.com', 'Recipient Name');

    // Content
    $mail->isHTML(true);
    $mail->Subject = 'Test Email via PHPMailer SSL Port 465';
    $mail->Body    = '<h1>Hello!</h1><p>This is a test email sent using PHPMailer over SSL (port 465).</p>';
    $mail->AltBody = 'Hello! This is a test email sent using PHPMailer over SSL (port 465).';

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

 

PEAR Mail

Update existing PHP code using PEAR Mail to authenticate when sending email through the website.

Here is sample PHP code to authenticate when sending with PEAR Mail:

<?php
// Download a copy of PEAR Mail and Mime libraries (https://pear.php.net/package/Mail/download)
// Upload PEAR Mail and Mime libraries to your hosting service
// Update paths below to your copy of PEAR Mail
require_once "/home/cpanelusername/PEAR/Mail.php";
require_once "/home/cpanelusername/PEAR/Mail/mime.php";

$smtp = Mail::factory(
    'smtp',						// Use SMTP
    array(
        'host'     => 'ssl://mail.example.com',		// SMTP server
        'port'     => 465,				// Port for SSL
        'auth'     => true,				// Enable authentication
        'username' => 'your_email@example.com',		// SMTP username
        'password' => "your_password"			// SMTP password
    )
);

$from = "Your Name <your_email@example.com>";
$to = "Recipient Name <recipient@example.com>";
$cc = "cc-user@example.com";
$bcc = "bcc-user@example.com";

$headers = array (
    'From'    => $from,
    'To'      => $to,
    'Cc'      => $cc,
    'Subject' => $subject
);

$subject = "Test Email via PEAR Mail SSL Port 465";

$htmlBody = "<html><h1>Hello!</h1><p>This is a test email sent using PEAR Mail over SSL (port 465).</p></html>";
$textBody = "Hello! This is a test email sent using PEAR Mail over SSL (port 465).";

$mime = new Mail_mime(array('eol' => "\n"));
$mime->setHTMLBody($htmlBody);
$mime->setTXTBody($textBody);

$body = $mime->get();
$headers = $mime->headers($headers);

// Note: To and Cc go in the headers, but ALL recipients (To, Cc, Bcc) must be in the SMTP envelope.
$recipients = $to . ", " . $cc . ", " . $bcc;

$mail = $smtp->send($recipients, $headers, $body);

if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
}
else {
    echo("<p>Message successfully sent!</p>");
}

Please let us know if you have any questions or need further help.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

My Website is Down

For security, your IP address (see https://www.linksky.com/ip/) may have been automatically and...

How Do I Change/Reset My Email Password?

For security, we recommend changing all of your passwords every few months. Also, if your email...

How Do I Login to Webmail?

To login to Webmail, open your Web browser (Chrome, Firefox, Edge, Safari, etc.) and visit:...

How Do I Add an Email Address?

LinkSky hosted email addresses are a great way to promote your business, because you can setup an...

SSL Certificate for My Website

Great news, we include free Let’s Encrypt certificates for members! The goal is to provide a...