Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Moodle Hosting  >  How to Setup an SMTP Connection in Moodle?
Top Scroll

How to Setup an SMTP Connection in Moodle?

 2 min

When you send messages from Moodle, they can go via either PHP mail function or SMTP server connection.

Sometimes, the PHP mail function may get disabled on the server to secure your website from spam emails via compromised websites. To resolve this issue, you can configure the email to connect to an SMTP server. The SMTP server will connect with login details to authenticate the sending email address. Due to this the receiving email address server will be able to accept the email as authenticated. Some email servers don’t enable unauthenticated emails to go via their server and therefore, SMTP connection is good.

Steps to Configure SMTP Settings in Moodle

Log into your Moodle dashboard.

In the Settings section, go to Site administration -> Server -> Email -> Outgoing mail configuration.


Go to the Outgoing mail configuration page and configure SMTP settings. Moodle uses the PHP mail function by default to send emails. If the administrator wants to send the email to a specific SMTP server such as Yahoo or Gmail, you can adjust the SMTP configuration settings to enable the use of a different server.


In this post, we will use a Gmail email address for the SMTP settings. You need to configure the below email fields for the mail to work. Check below the example of a generic setup of Gmail SMTP:

SMTP SettingsDescription
SMTP hosts The SMTP host is the server to which the email address gets connected.
SMTP securitySMTP security will decide whether to encrypt the outgoing email data or not. The SSL setting must be exactly similar to the connection used for the SMTP Host name.
SMTP usernameIt is the full email address for the email account. Most email service providers will need the complete email address for the username.
SMTP passwordIt is the password for the specific email address that is you are setting up.
SMTP session limitIt helps to prevent spam coming from the same session on the server. If you limit to 1, you will need to create a new session in order for an email to be set.
No-reply addressIt displays in the return email address. It prevents the email address from being replied to by the recipient.
Character setIt enables you to change the Character set to UTF-8, EUC-JP, GB18030, GB2312, ISO-2022-JP, ISO-8859-1, or SHIFT-JIS.
Allow user to select character setIt allows users to change the Character set.
Newline characters in mail It sets the character type used for Newline characters.

After you fill the correct information, click on Save changes. Now the messages that you send via Moodle will get delivered to the Gmail server as an authenticated user.

In this way, you can setup an SMTP connection in Moodle.

Also Read

Modifying Site Administrators in the User Permissions Section of Moodle

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
Claim the discount before it’s too late. Use the coupon code:
Note: Copy the coupon code and apply it on checkout.