Re: Gmail/email & PHP

[email protected] Sat, 31 May 2025 11:56:13 +1200
Newsgroups gmane.comp.php.general
Message-ID <CACOt7mHgiBz0Wrk4Nh=Ci+KGpeRWFKz3CQRrT=0p5btj1Yu2tQ@mail.gmail.com>
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 = '[email protected]';
    $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('[email protected]', 'Kwister Mailer');
     $mail->addAddress('[email protected]');
    $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
<[email protected]> 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.