Setting up an SMTP Connection in Moodle

Messages sent from Moodle can go through either the PHP mail function or through SMTP server connection. In some cases, the PHP mail function may be disabled on the server (Depending on the hosting company) to prevent spammers from sending emails through compromised websites. To work around this, the email can be configured to connect to an SMTP server. An SMTP connection will connect to an email server with login credentials, authenticating the sending email address. This will allow the receiving email address server to accept the email as authenticated. This is good because some email servers do not allow unauthenticated emails to go through to their server. The following steps will explain how to configure the Moodle 2.3 messaging to use SMTP.

Configuring SMTP settings in Moodle

  1. Log into the Moodle Dashboard
  2. smtp-setup-plugin-1-select

    Navigate to Site administration > Plugins > Message outputs > Email in the settings section.

  3. smtp-setup-plugin-2-smtp

    On the Email page, configure the SMTP settings. By default Moodle will use the PHP mail function to send emails. If the administrator wants the email to go to a specific SMTP server, Like Gmail or Yahoo, the SMTP configuration settings can be adjusted to allow a different server to be used.

    In this tutorial, a Gmail email address will be used for the SMTP settings. The following fields will need to be configured for the mail to work. Below is an example of a generic Gmail SMTP set up.

    SMTP hosts: smtp.gmail.com:465
    (The port number must be attached to the Server host name for the port to be used. The standard configuration for the port will follow the hostname:port# format.)

    SMTP security: SSL
    (This setting will vary on the email servers SMTP setting requirements. For Gmail, SSL is required for the connection.)

    SMTP username: [email protected]
    (The full email address for the username)

    SMTP password: Password for the email address.

    Below is a table with the settings for configuring the email messaging.


    Messaging output / Email
    SMTP hostsThe SMTP host is the server the email address connects to. For example, on our servers, the SMTP host will look something like the following:
    mail.yourdomaincom (None)
    secure##.inmotionhosting.com (SSL)
    SMTP securitySMTP security will either encrypt the out going email data or not. The SSL setting must match the same type of connection that was used for the SMTP Host name.
    SMTP usernameThis will be the full email address for the email account. Most email service providers require the entire email address for the username.
    SMTP passwordThis is the password for the specific email address that is being set up.
    SMTP session limitThis setting can prevent spam coming from the same session on the server. Limiting to 1 will require a new session to be created in order for an email to be set.
    No-reply addressThe no reply address is what displays in the return email address. This prevents the email address from being replied to by the recipient.
    Character setAllows the Character set to be changed to UTF-8, EUC-JP, GB18030, GB2312, ISO-2022-JP, ISO-8859-1, or SHIFT-JIS.
    Allow user to select character setEnables the users to be able to change the Character set.
    Newline characters in mailThis sets the type of character used for Newline characters.


    Once the fields have the correct Email information in them, click Save changes. Now messages sent through Moodle will deliver to the Gmail server as an authenticated user.

IC
InMotion Hosting Contributor Content Writer II

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

2 thoughts on “Setting up an SMTP Connection in Moodle

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+