Moodle eMail Test

General plugins (Local) ::: local_mailtest
Maintained by Michael Milette
Moodle eMailTest is a powerful tool that enables administrators to test Moodle’s email system with ease. With this plugin, you can rest assured that your emails will be delivered without any hiccups. In case of any issues, a trace of the SMTP dialogue will be displayed. The plugin will also attempt to diagnose the issue and help you identify and resolve the problem quickly.
Latest release:
11073 sites
1k downloads
125 fans
Current versions available: 1

The Moodle eMailTest plugin is a tool that enables administrators to easily test Moodle's mail system. A trace of the SMTP dialogue will be displayed if the email message cannot be sent for any reason. Version 3.x+ comes with a new diagnostic feature that helps you narrow down the issue and offers potential solutions. This feature makes it easier than ever to identify and resolve any problems with your email system.

Please note that once you’ve sent a test email, you’ll need to check your inbox to confirm that the message was delivered successfully. While this plugin won’t do that for you, it will provide troubleshooting suggestions if the email doesn’t make it to your inbox.

Potential privacy issues

Note that the email sent to the recipient contains details about the administrator and the site including account username, web browser, IP address, Moodle version and preferred language.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5

Contributors

Michael Milette (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Sonia Pichardo
    Fri, 8 Jan 2016, 7:29 AM
    OK when I send a message to verified gmail or other email account. I get the message "The test message was successfully delivered to the SMTP server", but no message arrives to the email address. What am I missing regarding the plugin?
  • Michael Milette
    Sat, 9 Jan 2016, 1:29 AM
    Hi Sonia! Thank you for your question.

    The plugin is likely working as it was made to. It simply tests whether Moodle was able to successfully deliver an email to the SMTP server. It cannot determine what happens to that email message after the server accepts it. For example, the server could reject it if it considers it to be SPAM or there could be a problem with the SMTP server's ability to forward the message. Your next step would be to check the SMTP server logs to see what it did with your message which is not part of the plugin's functionality since this isn't part of Moodle.

    If you want to double check the SMTP dialogue between Moodle and the SMTP server, just click Home > Site Administration > Development > Debugging and check the box for "Debug email sending". Then go back and repeat the test. The results should be display, even if the plugin doesn't detect a problem.

    Hope this helps.

    Best regards,

    Michael
  • Patricio Lopez
    Tue, 16 Feb 2016, 10:47 PM
    Hello I installed this on a Moodle 3.0.1+ (Build: 20151231) and after install it gave me an error 500. Regards.
  • Michael Milette
    Sun, 22 May 2016, 12:11 AM
    New version of MailTest just release. Now supports Moodle 2.5 to 3.1, additional sender email options, provides clearer information, and includes a new FAQ in the README file.
  • Jason De Donno
    Thu, 1 Sept 2016, 8:01 PM
    Hi! Can I just ask, that, if an email is successful, does it also mean that CRON is running correctly for sending emails?
  • Michael Milette
    Fri, 30 Sept 2016, 9:08 PM
    Great question Jason. Some emails are sent out immediately while others are scheduled and only sent out when Cron runs. Other things that are often affected by Cron jobs are report generation. Eventually, if you never run cron, your Moodle site will also stop working so it is important to make sure that this is setup properly.

    As a Moodle Administrator, you can check if Cron is running regularly by going to the Site Administration > Notifications.

    If cron hasn't run in the last 24 hours, you will see something like:

    "The cron.php maintenance script has not been run for at least 24 hours.

    If you don't see anything about it, chances are that Cron is running automatically at least once a day.

    There is also the possibility that an error is preventing Cron from working properly. The likelihood of this happening is much lower since Moodle 2.7. You should be able to manually run Cron and see the results by logging in as a Moodle Administrator and going to:

    http://example.com/admin/cron.php

    Just replace "http://example.com/" with the URL to the root of your Moodle site.

    There are some settings in Moodle which can prevent this URL from working so, if it doesn't seem to work, don't assume that Cron doesn't work. It might just be some Moodle settings. If Cron is running regularly, the displayed log might be pretty short as there are items which are only run once a day which may not appear in the list. This is especially noticeable if you run Cron manually twice in a row.

    Thanks again for asking. I will add a check for cron similar to the one on the Notifications page to let you know if there is a problem with the scheduling of the cron script in the next version of the mailtest plugin as this could be a potential reason why emails don't seem to be delivered.

    By the way, it's never too late to setup Cron. Not only will you find that your Moodle site works better, it may actually work faster too. If you are running Moodle on a Unix/Linux based server, documentation on how to set it up can be found at https://docs.moodle.org/31/en/Cron. If you are running Moodle on Windows, you may have noticed that "cron" doesn't exist. However Windows does also include a Scheduler. You will find details on how to set that up by going to https://docs.moodle.org/31/en/Cron_with_Windows_OS.

    Best regards,

    Michael Milette
  • Mahmood Naderan
    Wed, 4 Oct 2017, 5:38 PM
    Hi,
    Do you have any idea for the following error:

    2017-10-04 09:29:37 SERVER -> CLIENT: 250 Recipient accepted
    2017-10-04 09:29:37 CLIENT -> SERVER: DATA
    2017-10-04 09:29:37 SMTP -> get_lines(): $data is ""
    2017-10-04 09:29:37 SMTP -> get_lines(): $str is "452 Sent messages limits exceeded
    "
    2017-10-04 09:29:37 SERVER -> CLIENT: 452 Sent messages limits exceeded
    2017-10-04 09:29:37 SMTP ERROR: DATA command failed: 452 Sent messages limits exceeded
    2017-10-04 09:29:37 SMTP Error: data not accepted.

    The test email message could not be delivered to the mail server.



    The email test OK and it was working perfectly.
  • Michael Milette
    Wed, 18 Oct 2017, 4:48 AM
    Hi Mahmood,

    This error message usually appears when you have too many email recipients or there is a limit on how many emails you can send through your mail server.

    Since MailTest only sends messages to a single recipient at a time, it is probably more likely that your mail server provider has either placed a limit on how many emails you can send through it or that you have exceeded the storage quota of your email account or the physical drive.

    This actually happened to me recently. My ISP created a mailbox for my account when I signed up. Each time a cron job would run, it would send an email to that account. Over the years it added up to over 500,000 emails. There were so many emails that they had to clear it from the command line as there was no email client that could handle this many emails. It really surprised me as I was not even aware that the email address even existed.

    As for your situation, the next step would be to contact your service provider and get them involved in troubleshooting the mail server.

    Hope you find this useful. Best regards,

    Michael
  • Michael Milette
    Sat, 11 Nov 2017, 3:40 PM
    Great news! eMailTest for Moodle has now been tested and approved for use with Moodle 2.5 to 3.4. Other than the testing, there are no changes to the code, only to the documentation.
  • Ernie Havermale
    Thu, 7 Dec 2017, 4:50 AM
    Hello,

    I downloaded this plugin to test my moodle emailing functions. I am getting the following message:

    2017-12-06 20:39:13 Connection: opening to smtp.sendgrid.net:587, timeout=300, options=array (
    )
    2017-12-06 20:39:19 Connection: opened
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is ""
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "220 SG ESMTP service ready at ismtpd0005p1iad1.sendgrid.net
    "
    2017-12-06 20:39:19 SERVER -> CLIENT: 220 SG ESMTP service ready at ismtpd0005p1iad1.sendgrid.net
    2017-12-06 20:39:19 CLIENT -> SERVER: EHLO starslms.com
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is ""
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-smtp.sendgrid.net
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-8BITMIME
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    250-8BITMIME
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-PIPELINING
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    250-8BITMIME
    250-PIPELINING
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-SIZE 31457280
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    250-8BITMIME
    250-PIPELINING
    250-SIZE 31457280
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-STARTTLS
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    250-8BITMIME
    250-PIPELINING
    250-SIZE 31457280
    250-STARTTLS
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is "250-smtp.sendgrid.net
    250-8BITMIME
    250-PIPELINING
    250-SIZE 31457280
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    "
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "250 AUTH=PLAIN LOGIN
    "
    2017-12-06 20:39:19 SERVER -> CLIENT: 250-smtp.sendgrid.net
    250-8BITMIME
    250-PIPELINING
    250-SIZE 31457280
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    250 AUTH=PLAIN LOGIN
    2017-12-06 20:39:19 CLIENT -> SERVER: STARTTLS
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is ""
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is "220 Begin TLS negotiation now
    "
    2017-12-06 20:39:19 SERVER -> CLIENT: 220 Begin TLS negotiation now
    2017-12-06 20:39:19 SMTP Error: Could not connect to SMTP host.
    2017-12-06 20:39:19 CLIENT -> SERVER: QUIT
    2017-12-06 20:39:19 SMTP -> get_lines(): $data is ""
    2017-12-06 20:39:19 SMTP -> get_lines(): $str is ""
    2017-12-06 20:39:19 SERVER -> CLIENT:
    2017-12-06 20:39:19 SMTP ERROR: QUIT command failed:
    2017-12-06 20:39:19 Connection: closed
    2017-12-06 20:39:19 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting


    I installed a separate version of PHPMailer and set up a test email using the same SMTP settings Moodle is using and I received the email from the standalone PHPMailer. I have DEVELOPER mode turn on for Moodle and it didn't seems to add more messages. Do you have an suggestion as to why the connect seems to fail at the TLS handshake.

    I am using PHP 5.6 / moodle version 3.2

    Thank you,
    Ernie
  • Michael Milette
    Fri, 8 Dec 2017, 5:27 PM
    Hi Ernie,

    Turning on DEVELOPER mode won't produce any additional information because that is exactly what the plugin does in order to capture and display this information.

    As for your error message, did you take a look at the link it suggested on the last line? https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Search the page for "SMTP Error: Could not connect to SMTP host." and anything to do with "TLS". Also note the section that specifically mentions "PHP 5.6".

    TLS stands for "Transfer Layer Security" which is all about secure encrypted email communication. I am not familiar with your email environment but your problem could be with openssl, DNS, port, credentials, server configuration, etc. If your successful test was on the same server as your instance of Moodle, that could eliminate many of these possibilities. What remains is potential conflicting configuration issues, on the web server and/or the mail server.

    When you tried using a standalone instance of PHPMailer, you are very likely using different configuration settings as well. The next step would be to compare the configuration between the two instances of PHPMailer. Comparing their interaction with the SMTP server might reveal something of significance.

    Have you tried conducting your test using the version of PHPMailer that is included in Moodle's /lib/phpmailer folder? Have you tried sending email using PHP's own mail() function?

    Hope this gives you some ideas of things to try.

    Best regards,

    Michael
  • Michael Milette
    Fri, 8 Dec 2017, 5:33 PM
    Ernie, don't forget to make sure that you are using a valid (real) no-reply email address. I've seen a problem similar to this and switching the no-reply email address to a real one did the trick.
  • Mahmood Naderan
    Fri, 8 Dec 2017, 9:25 PM
    @Ernie, I would like to suggest testing the moodle with a gmail account. Usually institutes have different rules and staffs, so it may be hard to find the bottle neck. However, Gmail is freely available and you can enter the imap and smtp and ports. If the Gmail test was successful, that means everything is ok with you moodle. Then you have to consult with your admin.
  • Nick Boyd
    Sat, 2 Feb 2019, 2:13 PM
    So simple but so needed, thank you
  • Samir Pessanha
    Mon, 23 Mar 2020, 1:24 AM
    Hello. I have a problem with my project and I can't solve them.
    this is the error:

    Connection: opening to outlook.office365.com:993, timeout=300, options=array()
    2020-03-22 15:28:41 Connection failed. Error #2: stream_socket_client(): unable to connect to outlook.office365.com:993 (Permission denied) [/var/www/html/lib/phpmailer/src/SMTP.php line 324]
    2020-03-22 15:28:41 SMTP ERROR: Failed to connect to server: Permission denied (13)
    2020-03-22 15:28:41 SMTP connect() failed.

    I searched in the internet but any resolution resolve



Please login to post comments