-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Disable function mail #52
Conversation
IMHO |
.travis.yml
Outdated
@@ -12,6 +12,7 @@ install: | |||
|
|||
script: | |||
- vendor/bin/tester tests -s | |||
- php -c tests/disable-mail.ini tests/Mail/SendmailMailer.phpt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add another script. You may use @phpIni disable_function=mail
annotation in test.
src/Mail/SendmailMailer.php
Outdated
@@ -29,6 +29,9 @@ class SendmailMailer implements IMailer | |||
*/ | |||
public function send(Message $mail): void | |||
{ | |||
if (function_exists('mail') === false) { | |||
throw new SendException('Unable to send email: mail() has been disabled for security reasons.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would not print the reason. has been disabled.
is IMHO enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milo fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/mzk/mail/commits/disable-function-mail tady ten commit je, ale v pull requestu se neobjevil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
While is the function
mail()
disabled, the conditionif ($res === false) {
isn't catched.The code will pass silently, but the email is not sent.
I'm not sure, how to fix. (in nette/mail or in Nette/Utils). Thanks for help.