-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Feature - Send Test Mail #8643
Feature - Send Test Mail #8643
Conversation
COM_CONFIG_SENDMAIL_BODY="This is a test mail. If you receive it, then your email settings are correct!" | ||
COM_CONFIG_SENDMAIL_ERROR="Test mail could not be sent." | ||
COM_CONFIG_SENDMAIL_SUBJECT="Test mail from %s" | ||
COM_CONFIG_SENDMAIL_SUCCESS="Mail sending process executed properly. Additionally, you should check whether you've received the test mail!" |
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.
Can this be simplified into more basic english? Perhaps
"The email was sent successfully. You should check that you've received the test email."
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.
Sure, I've expected a correction from you! :-P
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.
Done! :-)
I have tested this item ✅ successfully on bf8e351 I think its a little confusing (or not documented) that the test email is sent to the email address defined in the From email field This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
This PR has received new commits. CC: @brianteeman This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
@brianteeman Thank you for testing it. Yes, this should be documented. Maybe directly in the success message? If yes, could you please send me the correct wording? |
how about |
Or even better |
@brianteeman Good idea! |
Might be worth changing the email body message as well to show the settings Perhaps And even better if it could include all the options for that method Otherwise when testing and receiving multiple emails you dont know which On 10 December 2015 at 14:37, Viktor Vogel notifications@github.com wrote:
Brian Teeman |
This PR has received new commits. CC: @brianteeman This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
@brianteeman PR updated with your suggestions. Could you please re-test? Thank you! |
Completely stopped working now On 10 December 2015 at 16:15, Viktor Vogel notifications@github.com wrote:
Brian Teeman |
Correction - I received the emails with the updated message so it was just in the Joomla admin that I was not getting any messages This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
@brianteeman I've changed the JavaScript file, so you have first to clear your browser cache. |
I have tested this item ✅ successfully on 43ba153 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
This PR has received new commits. CC: @brianteeman This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
This PR has received new commits. CC: @brianteeman This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
I have tested this item ✅ successfully on a4000f2 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
tested successfully |
|
||
$model = new ConfigModelApplication; | ||
$response = new JResponseJson($model->sendTestMail()); | ||
echo $response->__toString(); |
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.
Noooope. __toString
is a magic PHP method. echo (string) $response
is what you need
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.
Don't even need the (string) typecast. echo will automagically convert it. Take a look at https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_languages/controllers/strings.json.php and see how nice and simple it is.
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.
Ooops, misunderstood it... :-) Thanks guys!
$conf->set('mailonline', $input->get('mailonline')); | ||
|
||
// Prepare email and send try to send it | ||
$mail_subject = JText::sprintf('COM_CONFIG_SENDMAIL_SUBJECT', $conf->get('sitename')); |
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.
Camelcase variable as per our code style guidelines please
Switching only to SMTP and not filling any SMTP settings activates the phpmail fallback on clicking the button. The message states "The email was sent successfully to rick@r2h.nl using SMTP. You should check that you've received the test email." But it should give a message that not all SMTP settings are filled ans mail cannot be sent. Also filling all the fields with false date ativates the fallback to phpmail and ther is also no error message. |
This PR has received new commits. CC: @brianteeman, @pe7er This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
I have tested this item ✅ successfully on bf5ba5e This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
1 similar comment
I have tested this item ✅ successfully on bf5ba5e This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
Beside that the thing is working, I have the note to 😄 In suggested implementation So my suggestion is to use "common routine" (form filtering and validation) instead of fancy stuff with Take $form = $model->getForm();
$validatedData = $model->validate($form, $data);
$result = $model->sendTestMail($validatedData); To make the form validate only Email params, in the model Just suggestion 😄 |
Setting RTC- would be good to get this in 3.5 and not have to wait a year for 3.6 - there are no b/c issues This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8643. |
This PR adds a new button ("Send Test Mail") in the Global Configuration with which the email settings can be tested with one click!
After the click on the button, the email data is transferred via an Ajax request to the server and a test mail is created and sent to the specified email address. If the sending process fails, a message with the error is displayed (see screenshots).
You don't have to save the configuration first, because the sending process will always be executed with the current entered values. Once the email settings are right, you should save them with a click on the "Save" button.
How to test
Install patch, go to the Global Configuration and click on the button! :-)
Change some settings (e.g. enter wrong values) and try it again.
Important: You should also test on an online server from which you really can send emails to receive the test mail. For instance, on local environments the "PHP Mail" option does not throw an error even though the email was not sent (if not configured properly)!