OK. So I´m back 😃 I´m trying out the PHPMailer. I´ve uploaded the files and created a file called "send.php".
I execute the file in the browser to see if it works before I go any further. I then get this message:
2022-07-05 20:50:04 SERVER -> CLIENT: 220 websmtp.simply.com ready. Authentication required.
2022-07-05 20:50:04 CLIENT -> SERVER: EHLO perfect-nme.com
2022-07-05 20:50:04 SERVER -> CLIENT: 250-websmtp.simply.com250-PIPELINING250-SIZE250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250 CHUNKING
2022-07-05 20:50:04 CLIENT -> SERVER: STARTTLS
2022-07-05 20:50:04 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2022-07-05 20:50:04 CLIENT -> SERVER: EHLO perfect-nme.com
2022-07-05 20:50:04 SERVER -> CLIENT: 250-websmtp.simply.com250-PIPELINING250-SIZE250-ETRN250-AUTH PLAIN LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250 CHUNKING
2022-07-05 20:50:04 CLIENT -> SERVER: AUTH CRAM-MD5
2022-07-05 20:50:04 SERVER -> CLIENT: 334 PDU1MTY0MzEzMzgyNDk5NzkuMTY1NzA1NDIwNEBhc210cC51bm9ldXJvLmNvbT4=
2022-07-05 20:50:04 CLIENT -> SERVER: [credentials hidden]
2022-07-05 20:50:06 SERVER -> CLIENT: 535 5.7.8 Error: authentication failed: PDU1MTY0MzEzMzgyNDk5NzkuMTY1NzA1NDIwNEBhc210cC51bm9ldXJvLmNvbT4= - For help see https://simply.com/support/?s=websmtp.simply.com
2022-07-05 20:50:06 SMTP ERROR: Username command failed: 535 5.7.8 Error: authentication failed: PDU1MTY0MzEzMzgyNDk5NzkuMTY1NzA1NDIwNEBhc210cC51bm9ldXJvLmNvbT4= - For help see https://simply.com/support/?s=websmtp.simply.com
SMTP Error: Could not authenticate.
2022-07-05 20:50:06 CLIENT -> SERVER: QUIT
2022-07-05 20:50:06 SERVER -> CLIENT: 221 2.0.0 Bye
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
Here´s the send.php:
<?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'websmtp.simply.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = myemail@hello.com'; //SMTP username
$mail->Password = 'Spassword'; //SMTP password
$mail->SMTPSecure = 'TLS'; //Enable implicit TLS encryption
$mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('myemail@hello.com', 'Test');
$mail->addAddress('myemail@hello.com', 'Joe User'); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'PERFECT NME - Contact';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
The authentication username and password is my e-mail account right? God, it´s been a while 😃
Hope you guys can help.