geodesicsolutions-community / geocore-community

GeoCore Community, open source classifieds and auctions software
MIT License
9 stars 6 forks source link

SMTP Amazon Simple Email Service (SES) #161

Closed vinprom1 closed 1 year ago

vinprom1 commented 2 years ago

Hello, i want send emails with Amazon Simple Email Service (SES) SMTP but Main Email Sender addon not send it. With mailjet.com or other providers SMTP work fine, only Amazon SES not work.

vicos59 commented 2 years ago

1) Which version are you using? 2) Is this a new installation or an upgrade to a previous version? 3) I assume we are talking about configuration via the following page:

email

4) Have you successfully used Amazon Simple Email Service (SES) SMTP with other applications?

Otherwise, just guessing, perhaps related to some security setting on Amazon. Does the app have to be authorized or use a special password/token. I know that Google is moving to not allow apps to connect to gmail in the future and in the mean time requires a special setting to allow it to work. Is there any logging on Amazon to show why the connections are failing?

vinprom1 commented 2 years ago

Hello, i use v18.02.0 upgraded from v17.01.0 Yes i talk for this setting "General Email Settings". I enter everything correctly and when I send a test email, it doesn't give me any error. Everything seems to be sent normally but in the Amazon dashboard does not reflect the email I sent. I tried the same Amazon SES SMTP settings on laravel (LaraClassified) and there emails are sent without any problems. Firefox_Screenshot_2022-04-08T15-49-25 400Z

vinprom1 commented 2 years ago

I see that there is a + sign at the end of the password Could this affect the php script (addon) when sending emails?

vicos59 commented 2 years ago

Which version of PHP are you using?

Is the site in production right now or are you just getting it set up?

So what do we know so far? The SMTP sends works with other SMTP servers, just not Amazon as configured. You are able to send using Amazon SMTP from another classifieds program. Therefore, it must be 1 of 2 things:

1) The config data entered into GeoCore is incorrect. Try re-entering all of the critical data, especially password to make sure it entered properly.

2) GeoCore has a problem talking with Amazon SMTP. 18.02 is old by software standards and I believe it uses an old version of SwiftMailer.

Troubleshooting w/o log info is tough. I would try the following:

1) Contact Amazon support to see if there is any logging on SMTP connection attempts on their end. At least then you could get some clues.

2) If you are not in production, there is a debug Addon for GeoCore. Not sure if it would be helpful here or not.

3) If you have the time and ability, install a copy of the current GeoCore v20 snapshot to see if it works. Alternatively, if you have some test credentials you could pass to me privately, I could try it on my test site for you.

4) If you are not in production, you could tell PHP to display all errors and warnings to see if there are clues there. Also, Bring up the browser inspector and watch the console for any errors. Sometimes if there is an error, you might not see it in the browser based on where it shows up in the page's DOM.

I hope this helps. Like I said, its tough to troubleshoot anything with feedback from the systems involved in the transaction.

vinprom1 commented 2 years ago

Thanks vicos59, I understand that the reasons can be many. I use Apache and php 7.4 I will install GeoCore v20 and will test. debug Addon for GeoCore is enabled but not have a errors. In my Ubuntu var/logs not see php errors for this site. I think SwiftMailer is old version.

vicos59 commented 2 years ago

I just uploaded the snapshot I built on 03-MAR-2022 to:

https://we.tl/t-OzStjHdsXU

This uses wetransfer.com. I don't have access to build files on this project on Github.

Otherwise, you would have to install docker and issue the command to build it. You can't just download the source since it uses composer to install things.

Beta-4 is the last official release built:

https://github.com/geodesicsolutions-community/geocore-community/releases

There were numerous fixes after that. Actually, other than Facebook login, the current snapshot should be pretty stable and work with PHP 8.1.

If you want to build your own release:

https://github.com/geodesicsolutions-community/geocore-community/discussions/153

vinprom1 commented 2 years ago

I did a new installation of this version https://we.tl/t-OzStjHdsXU , but unfortunately Amazon SES does not work again. The new version of the script is great and I don't have to fix PHP errors ;) Tomorrow I will try to update my site with this new version (i'll try on PHP 8.1) and I hope everything goes well. Is there a possibility for any update on SwiftMailer?

vicos59 commented 2 years ago

Be sure to follow the instructions for upgrading on the wiki https://geodesicsolutions.org/wiki/update/start --- especially if you have not yet removed the licensing.

As far as an update for SwiftMailer. I don't think that would happen any time soon, The developer/maintainer for this project has stepped away for a time. I know it was discussed, though.

vinprom1 commented 2 years ago

I understand. Too bad ;( By the way, I found a bug on PHP 8.0 / 8.1 when click on SEO addon > General Settings


TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /addons/SEO/admin.php:281 Stack trace:

0 /addons/SEO/admin.php(281): in_array()

1 /admin/php5_classes/Admin.class.php(543): addon_SEO_admin->display_addon_SEO_main_config()

2 /admin/index.php(16): geoAdmin->load_page()

3 {main}

I will test everything on PHP 8.0 / 8.1 before updating to this version. If I find something I will create a new bug report topic

vinprom1 commented 2 years ago

This is probably one of the most professionally made scripts and I'm glad you didn't leave it to the wind! It's great that it's already a free MIT license. You're cool! Keep going!

vicos59 commented 2 years ago

when click on SEO addon > General Settings

That's odd. I don't get those errors on 8.1.3 on my Docker setup. I do get the following:

Deprecated: Optional parameter $type declared before required parameter $parent is implicitly treated as a required parameter in /var/www/html/src/classes/cjax/core/classes/cjax.class.php on line 170

Can you post your exact PHP version. Does the page load at all or just dies with the error?

Feel free to create new issues if you find more bugs. The only ones we know about right now are documented in this discussion:

https://github.com/geodesicsolutions-community/geocore-community/discussions/95

The posts with hearts on them have been fixed. I think there are 3 outstanding ones at the bottom of the page. But, mainly obscure addons few people probably use.

BTW, I moved your SEO bug report #162 into a new issue so we can keep things organized.

vinprom1 commented 2 years ago

Hi vicos59, can you update the swiftmailer to v6.0? Amazon's SES smtp server is very important to me. Without it, my site become almost unusable ;(

vicos59 commented 2 years ago

I hate to say it, but your best bet may be to hire a coder to fix it for you. They could clone the repository, make the fix, then if you want to contribute back, issue a pull request to have the new code incorporated back into the main repo here.

Just a note:

Swiftmailer is not maintained anymore. Use Symfony Mailer instead. Read more on Symfony's blog.

https://swiftmailer.symfony.com/docs/introduction.html

The swiftMailer repo:

https://github.com/swiftmailer/swiftmailer

vinprom1 commented 2 years ago

I will try to fix this bug myself. If I succeed I will share here.

vicos59 commented 2 years ago

You might get away with just substituting the latest swiftMailer library code in the appropriate place.

It looks like the code is at:

src\classes\php5_classes\swift5

vinprom1 commented 2 years ago

:) I will try, but it will hardly be that easy

vinprom1 commented 2 years ago

I try with latest swiftmailer but it still not work with Amazon SES. I will read more on the Internet about this problem. I think it's a small bug to fix, but ...

vicos59 commented 1 year ago

I believe the conclusion here is that we need an update from swiftmailer (now obsolete) to its replacement, symfony.

Swiftmailer is not maintained anymore. Use Symfony Mailer instead. Read more on Symfony's blog.

https://swiftmailer.symfony.com/docs/introduction.html

@blufyremedia Should we close this issue an open a new enhancement request issue, or just leave this open to serve as the enhancement request? If the latter, might want to change the title to something more appropriate.

blufyremedia commented 1 year ago

The root problem for this specific issue is actually a much smaller bug, and not related to the library itself (the current library works with AWS SES). A quick fix has been applied via commit a46360b

Beyond that, swapping out the mailer library in the CE is ideal moving forward, so that can get logged as a separate request.