Re: Gmail/email & PHP
| From: | gordonisnz at gmail dot com | Date: | Fri, 30 May 2025 23:56:13 +0000 |
| Subject: | Re: Gmail/email & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-328717@lists.php.net to get a copy of this message | ||
heres my test script :-
all i want to do is send (& receive - using a different address) emails via PHP
The latest error i'm getting is:- Mailer Error: SMTP Error: Could not
authenticate.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require
'/home/users/web/b2978/pow.kwisternet/usr/phpmailer/PHPMailer-master/src/Exception.php';
require
'/home/users/web/b2978/pow.kwisternet/usr/phpmailer/PHPMailer-master/src/PHPMailer.php';
require
'/home/users/web/b2978/pow.kwisternet/usr/phpmailer/PHPMailer-master/src/SMTP.php';
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.kwister.com';
$mail->SMTPAuth = true;
$mail->Username = 'email1@kwister.com';
$mail->Password = 'PASSWRD';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->SMTPOptions = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
];
$mail->setFrom('email1@kwister.com', 'Kwister Mailer');
$mail->addAddress('email2@kwister.com');
$mail->Subject = 'PHPMailer Test mailer';
$mail->Body = 'This is a PHPMailer test email.';
$mail->send();
echo 'Message sent';
} catch (Exception $e) {
echo "Mailer Error: {$mail->ErrorInfo}";
}
?>
On Sat, 31 May 2025 at 11:22, Richard
<inbound-lists-php@listmail.innovate.net> wrote:
>
> In order for people to provide much assistance you need to give
> details of what you are trying to do and how you are doing it as well
> the results you are getting - including errors and potentially
> information from your mail logs.
>
> If you are trying to deliver mail to gmail on port 25 you'll need to
> have the necessary DMARC set up for the FQDN that you're using. For
> the submission ports - 465/587 - and to retrieve mail you'll either
> need to support Oauth 2.0 or be using an app password - rather than
> an account login id/pw for authentication.
>
> These are just a couple of issues. There are a range of other things
> that can be obstacles, but without knowing details it's not worth
> trying to do more guessing.
>
>
--
Gordon.