Re: Gmail/email & PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx';
    $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@xxxxxxxxxxx', 'Kwister Mailer');
     $mail->addAddress('email2@xxxxxxxxxxx');
    $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@xxxxxxxxxxxxxxxxxxxxx> 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.



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux