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 hosts||The SMTP host is the server to which the email address gets connected.|
|Allow user to select character set||It allows users to change the Character set.|
|No-reply address||It displays in the return email address. It prevents the email address from being replied to by the recipient.|
|Character set||It enables you to change the Character set to UTF-8, EUC-JP, GB18030, GB2312, ISO-2022-JP, ISO-8859-1, or SHIFT-JIS.|
|SMTP session limit||It 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.|
|SMTP username||It is the full email address for the email account. Most email service providers will need the complete email address for the username.|
|SMTP password||It is the password for the specific email address that is you are setting up.|
|Newline characters in mail||It sets the character type used for Newline characters.|
|SMTP security||SMTP 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.|
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.