0
votes

how i can use my email like [email protected] in phpmailer. because i always have an error even i have a correct credentials.

2020-05-14 09:21:24 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP e13sm1851788pfh.19 - gsmtp
2020-05-14 09:21:24 CLIENT -> SERVER: EHLO localhost
2020-05-14 09:21:24 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [114.108.210.106]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-05-14 09:21:25 CLIENT -> SERVER: AUTH LOGIN
2020-05-14 09:21:25 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-05-14 09:21:25 CLIENT -> SERVER: [credentials hidden]
2020-05-14 09:21:25 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-05-14 09:21:25 CLIENT -> SERVER: [credentials hidden]
2020-05-14 09:21:25 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials e13sm1851788pfh.19 - gsmtp
2020-05-14 09:21:25 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials e13sm1851788pfh.19 - gsmtp
SMTP Error: Could not authenticate.
2020-05-14 09:21:25 CLIENT -> SERVER: QUIT
2020-05-14 09:21:25 SERVER -> CLIENT: 221 2.0.0 closing connection e13sm1851788pfh.19 - gsmtp
SMTP Error: Could not authenticate.

this is my configuration:

$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->SMTPAutoTLS = true; 
$mail->Username = '[email protected]';
$mail->Password = '';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
1
Is your domain set up to use gmail for email? - Synchro
@Synchro my email domain was setup in GSuite. - KEE-en
In that case check out the gmail authentication issues covered in the PHPMailer troubleshooting guide. - Synchro

1 Answers

0
votes

As per the logs that I have read you need to turn your Less Secure Account On. Follow this steps below.

Help CenterCommunity Setting up video conferencing for remote work? Set up Meet to help your team work remotely.

Control access to less secure apps This article is for administrators. For actions users can take, go to Less secure apps & your Google Account.

You can block sign-in attempts from some apps or devices that are less secure. Apps that are less secure don't use modern security standards, such as OAuth. Using apps and devices that don’t use modern security standards increases the risk of accounts being compromised. Blocking these apps and devices helps keep your users and data safe.

Examples of apps that don’t support modern security standards include:

​Native mail, contacts, and calendar sync applications on older versions of iOS and OSX​ ​Some computer mail clients, such as older versions of Microsoft Outlook Examples of apps that do support modern security standards are Gmail, Windows Mail, Office 365, Outlook for Mac, Instagram, PayPal, Amazon, Facebook, and Basecamp.

Transitioning to more secure app access to Google Accounts Less secure apps can make it easier for hijackers to break into user accounts and devices. Blocking sign-ins from these apps helps keep accounts safe. For these reasons, Google is limiting password-based programmatic sign-ins to Google Accounts.

If you don't allow sign-ins from less secure apps If you allow sign-ins from less secure apps Notice of setting removal Use alternatives to less secure apps Manage access to less secure apps You can allow users to turn on or off access by less secure apps or disable their ability to allow less secure apps.

Sign in to your Google Admin console. Sign in using your administrator account (does not end in @gmail.com).

Go to the settings for Less secure apps: From the Admin console Home page, go to Securityand thenLess secure apps. To see Security on the Home page, you might have to click More controls at the bottom.

OR, if the "Less secure apps" option isn't visible: From the Admin console Home page, go to Securityand thenBasic settings. Then, under Less secure apps, click Go to settings for less secure apps. Select the setting for less secure apps: Disable access to less secure apps (Recommended) Users can’t turn on access to less secure apps. When you disable access to less secure apps while a less secure app has an open connection with a user account, the app will time out when it tries to refresh the connection. Timeout periods vary per app.

Allow users to manage their access to less secure apps Users can turn on or turn off access to less secure apps.