Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support smtp servers out of the box #3939

Closed
ioweb-gr opened this issue Apr 13, 2024 · 12 comments
Closed

support smtp servers out of the box #3939

ioweb-gr opened this issue Apr 13, 2024 · 12 comments

Comments

@ioweb-gr
Copy link
Contributor

Description (*)

Currently there's a huge email deliverability issue with default openmage because it's not using SMTP to send the emails, usually they're not signed with DKIM and end up in spam if you're lucky. Other solutions like aschroeder/smtp_pro don't work with website level configurations and are basically not updated for 10 years. If this platform is going to stay, it needs to have it's own compatibility layer with SMTP connections in my opinion.

Expected behavior (*)

The system should be able to send via SMTP and not only via sendmail

Benefits

It would improve email deliverability and security.

Additional information

@fballiano
Copy link
Contributor

why smtppro doesn't work for you? I've have on a lot of stores on v20/php8.3 and works perfectly

@fballiano
Copy link
Contributor

ah you mean that you can't configure a different smtp for every website? but the emails are correctly sent with the proper "from email address" depending on the store

@ioweb-gr
Copy link
Contributor Author

ioweb-gr commented Apr 13, 2024

First of all if you check the configuration options scopes, they're set to website = 0 so they won't work for multi-site, but we can patch this.

Secondly, after setting it up it throws this error for TLS on 587

        if ($this->_secure == 'tls') {
            $this->_send('STARTTLS');
            $this->_expect(220, 180);
            if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
                /**
                 * @see Zend_Mail_Protocol_Exception
                 */
                #require_once 'Zend/Mail/Protocol/Exception.php';
                throw new Zend_Mail_Protocol_Exception('Unable to connect via TLS');
            }
            $this->_ehlo($host);
        }

And that error for SSL on 465

        // open connection
        $this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);

        if ($this->_socket === false) {
            if ($errorNum == 0) {
                $errorStr = 'Could not open socket';
            }
            /**
             * @see Zend_Mail_Protocol_Exception
             */
            #require_once 'Zend/Mail/Protocol/Exception.php';
            throw new Zend_Mail_Protocol_Exception($errorStr);
        }

Granted the OpenMage version I tested this is low > OpenMage LTS 20.0.7 and using php 7.4 but still

I'm assuming it's not creating the stream context properly in each case causing the failure

@ioweb-gr
Copy link
Contributor Author

ah you mean that you can't configure a different smtp for every website? but the emails are correctly sent with the proper "from email address" depending on the store

Regarding that, in most providers if you set a different from address than the defined smtp address it will either get overwritten or the mail will be rejected by amavis. So you need to have the same smtp email address as the one you're sending from.

Sometimes a single smtp connection is not enough so it woudl be a bonus to have multiple smtp connections tied to email addresses.

But in any case I was referring to it having some issues sending as well.

@pquerner
Copy link
Contributor

I dont know much about the spec, but maybe its possible to not have Magento (PHP) do that but some different process on the host thats "made to do it"? This way we could save mbox (I think thats what they are called) files and that other process handles sending it?

@fballiano
Copy link
Contributor

btw the platform is gonna survive if the people who use it participate, there is no big company paying for everybody here and there's too little participation or support. personally I work my ass off for free in order to still have something to provide to my customers, which, btw, don't pay me for the OM development but just to apply those improvements to their store.

So my suggestion is to submit a PR to aschroeder/smtp_pro because realistically we're not gonna be able to redevelop and merge something like that in the core.

@fballiano
Copy link
Contributor

I'm seeing https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension/pulls PRs are not processed at all.

Maybe we could fork it and merge those PRs, I don't know, I'm already working on so many things.

@ioweb-gr
Copy link
Contributor Author

@fballiano First of all this is not meant to take it personally my friend.

I just see the issues as they arise and while I'm working on a solution I report them here as well. Whether they're bug reports or feature requests or anything I just put them here and see how we can proceed with them. Of course if I had found a solution I'd push it already but I haven't found it yet :)

Also I saw the same on the smtp pro extension, it's pretty much dead. No one cares about it that's why I thought this feature would be important in OpenMage.

Basically every other framework has smtp capabilities out of the box by now using symfony/mailer which is properly supported but because we have Zend ( 👎 ) we're stuck with all the issues it gives

@fballiano
Copy link
Contributor

All I can say is that all of us should be the change that they want to be (well, this is a quote heheheh), everybody has to take something in his/her own responsibility and do what they need

@Flyingmana
Copy link
Contributor

I did not read much of the comments.
But if its a change which does not cause many problems with existing integrations, I dont see a big reason against accepting a PR, if you find/have someone who is going to provide this changes.

@empiricompany
Copy link
Contributor

empiricompany commented Apr 13, 2024

+1 for a PR that implements it. I would like to contribute. personally I use aschroder smtp that have some issues when email cannot be delivered and block entire queue also some limitation with from headers and multistore under different domains.
this is my fork:
https://github.com/empiricompany/Magento-SMTP-Pro-Email-Extension

@alexh-swdev
Copy link
Contributor

alexh-swdev commented May 3, 2024

We are using Advanced SMTP which, I see now, is also in OM module fostering
https://github.com/OpenMageModuleFostering/artsonit_advancedsmtp

/Edit: And Sven Reichel also has a fork of it:
https://github.com/sreichel/magento-ArtsOnIT_AdvancedSmtp

@OpenMage OpenMage locked and limited conversation to collaborators Oct 17, 2024
@addison74 addison74 converted this issue into discussion #4287 Oct 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants