Skip to content
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

tec: Provide a Minz_Mailer class #2476

Merged
merged 2 commits into from
Aug 15, 2019
Merged

Conversation

marienfressinaud
Copy link
Member

@marienfressinaud marienfressinaud commented Aug 2, 2019

This class can be inherited to create Mailers dedicated to some specific tasks. You can have an example of how to use it with what I've done to send validation emails (here and here). It is inspired by how Rails works with emails.

My main concern with this code is that the calls to the SMTP server need to be finished before redirecting the user. We have no systems of parallel queues. But it may be not critical yet and we can go with it for the moment… ?

I also needed to change the Minz_View API a bit by replacing the change_view method by a _path one. It is now Minz_Request-agnostic and can support files different than the phtml ones.

To merge in --no-ff

The `_path` method is more powerful since it allows to choose the file
extension. It is also Minz_Request-agnostic, which is useful to reuse
the Minz_View class in other places.

`change_view` is now deprecated and a warning is logged if we use it.
Copy link
Member

@Frenzie Frenzie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty straightforward. Btw, phpcs has a couple of minor formatting complaints. ;-)

@marienfressinaud
Copy link
Member Author

marienfressinaud commented Aug 2, 2019

Indeed! I just disabled the linter on the PHPMailer lib since it's not our code, let's see how it goes (edit: it goes fine :))

@marienfressinaud
Copy link
Member Author

For some reason, when PHPMailer has a problem, it creates a file under p/i folder :/ I need to investigate that…

It uses PHPMailer under the hood and only supports PHP >= 5.5
@marienfressinaud
Copy link
Member Author

Fixed, it's just that I don't know how to concatenate two strings in PHP :D (I used a , instead of a . when calling the Minz_Log::error method).

@Frenzie
Copy link
Member

Frenzie commented Aug 7, 2019

It's probably because with echo() you can just pass multiple strings separated by commas, and concatenating them first would be less efficient. (Although presumably seldom in a way that'd be remotely noticeable.)

@jkinable
Copy link
Contributor

@marienfressinaud what's the status of this PR? Is it ready to be merged into dev?

@Frenzie Frenzie added this to the 1.15.0 milestone Aug 14, 2019
@jkinable jkinable mentioned this pull request Aug 14, 2019
10 tasks
@Alkarex Alkarex merged commit de26531 into FreshRSS:dev Aug 15, 2019
@marienfressinaud marienfressinaud deleted the tec/provide-minz-mailer branch August 16, 2019 06:21
@Alkarex Alkarex mentioned this pull request Oct 26, 2019
javerous pushed a commit to javerous/FreshRSS that referenced this pull request Jan 20, 2020
* Add Minz_View::_path method (replace change_view)

The `_path` method is more powerful since it allows to choose the file
extension. It is also Minz_Request-agnostic, which is useful to reuse
the Minz_View class in other places.

`change_view` is now deprecated and a warning is logged if we use it.

* Provide a Minz_Mailer to send emails

It uses PHPMailer under the hood and only supports PHP >= 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants