8000 Ability to start & stop SMTP connection when needed · Issue #43237 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Ability to start & stop SMTP connection when needed #43237

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

Closed
phamviet opened this issue Sep 28, 2021 · 5 comments · Fixed by #45307
Closed

Ability to start & stop SMTP connection when needed #43237

phamviet opened this issue Sep 28, 2021 · 5 comments · Fixed by #45307

Comments

@phamviet
Copy link
Contributor

Description
I am using Mailer in Messenger worker long lived process with AWS SES SMTP interface and it keep throwing error:

Expected response code "250" but got code "451", with message "451 4.4.2 Timeout waiting for data from client.

I know i can get rid of this error by setting ping_threshold: 0 but it is not efficient since the transport have to ping server on every email sending out. It is better to manually stop transport connection when Messenger message get handled (with all emails are sent out) and it will auto start on next message handling. But the problem is SmtpTransport start & stop methods are private and i have no way to access them.

@dvaeversted
Copy link
Contributor

Related to this missing possibility to manually stop a transport, is in long running jobs/workers where it only ever sends emails occasionally, you will end up having a constant connection open towards an SMTP server.

Not all servers like this, so in changing over from swiftmailer, we are currently debating whether we need to destroy the mailer after each iteration since the stop() method is called in the destructor.

@fabpot
Copy link
Member
fabpot commented Feb 4, 2022

Looks like a legit use case indeed. Is anyone willing to make start/stop methods public in a PR for 6.1?

@dvaeversted
Copy link
Contributor

I am willing to give it a go today :-)

@fabpot fabpot closed this as completed Feb 4, 2022
fabpot added a commit that referenced this issue Feb 4, 2022
…ersted)

This PR was merged into the 6.1 branch.

Discussion
----------

[Mailer] Allow manually stop() of SmtpTransport

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #43237
| License       | MIT
| Doc PR        |

Mark the `stop()` method on SmtpTransport as public, to allow greater control in long running jobs and similar.

Commits
-------

ac6c519 [Mailer] Allow manually start()/stop() of SmtpTransport
@jul6art
Copy link
jul6art commented Jun 5, 2023

Hi @fabpot is there an equivalent for 5.4 symfony LTS version?

@xabbuh
Copy link
Member
xabbuh commented Jun 14, 2023

@jul6art You'll need to update the component to Symfony 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
0