Shardj / zf1-future

PHP 8.1 compatible version of ZF1
BSD 3-Clause "New" or "Revised" License
440 stars 190 forks source link

Zend_Mail SMTP Oauth2 / XOauth2 #234

Open icyz opened 2 years ago

icyz commented 2 years ago

Google has stopped providing "Less secure app access" to third party applications. This means that from Zend_Mail we will no longer be able to send emails using gmail.

Does anyone have any idea how to get Zend_Mail working again with Oauth2 or XOauth2?

hungtrinh commented 2 years ago

@icyz i have package help Zend_Mail working again with Oauth2 here https://packagist.org/packages/hungtrinh/zend-mail-oauth2

icyz commented 2 years ago

Thanks @hungtrinh, I will try it as soon as possible. I think it's Oauth2 could be integrated in zf1-future instead use external package :-)

icyz commented 2 years ago

After install: Fatal error: Cannot declare class Zend_Cache, because the name is already in use in /library/Zend/Cache.php on line 28

I will investigate

hungtrinh commented 2 years ago

@icyz oops, look like you integrate hungtrinh/zend-mail-oauth2 with full zend framework 1 (library/Zend existed) => i guess that conflict with requires package zf1s/zend-mail: ^1.14 in this case may be i need move zf1s/zend-mail: ^1.14 into composer suggest section instead of requires section

Or you can follow this guide https://github.com/hungtrinh/zend-mail-oauth2#setup-autoload-zend-mail-oauth2-for-zend-framework-1-skeleton-project

woranl commented 1 year ago

Alternatively, you can create a new authorization method for OAuth2 and save it in Zend/Mail/Protocol/Smtp/Auth. Check out this blog post: http://piecewiseinc.blogspot.com/2013/02/send-mail-with-gmail-smtp-and-xoauth.html

develart-projects commented 1 year ago

Anyone to own this and create PR, pls?

hungtrinh commented 1 year ago

Anyone to own this and create PR, pls?

it's easy to extract code from https://packagist.org/packages/hungtrinh/zend-mail-oauth2 but I think it's better if we keep origin zf1-future functional, try make it back compatible, and forward compatible with php version 8++

develart-projects commented 1 year ago

@hungtrinh if someone has initiative, I'm not against it :)

develart-projects commented 1 year ago

@hungtrinh btw, you are right, that we have to be very cautious here, as some changes and new function can potentially override already inherited methods. Therefore I'll make as clear as possible, that some new functionality is comming. Thanks for bringing this into the discussion.