Email setup gmail: Difference between revisions

From MoodleDocs
(→‎See also: add tricks and tips)
Line 34: Line 34:
* Some sites may need the additional step of un-commenting the '''php_openssl.dll''' extension in <tt>php.ini</tt>.
* Some sites may need the additional step of un-commenting the '''php_openssl.dll''' extension in <tt>php.ini</tt>.


== See also==
==Tips and tricks==
[[Email settings]]
===Google Edu account===
 
There is a possible issue with a Google Edu account.  When an email goes out via Moodle, Google may change the reply to address to that of the Moodle sites general email.
 
[[ja:GmailでのEメール設定]]


===Google education edition with 1.9.9===
When using Google Education Edition with 1.99
When using Google Education Edition with 1.99


Line 48: Line 47:


This bit is server side more than moodle so if you are on managed or shared hosting the server admin will have to do the record (try submitting a request to have the record added with full details of how and why to do so) then follow the previous the directions in this record.
This bit is server side more than moodle so if you are on managed or shared hosting the server admin will have to do the record (try submitting a request to have the record added with full details of how and why to do so) then follow the previous the directions in this record.
== See also==
[[Email settings]]
[[ja:GmailでのEメール設定]]

Revision as of 16:00, 8 November 2010

Google's mail servers can be set up as the SMTP server for Moodle. This reduces or eliminates the need for an email service on a server and is especially useful if Google Apps is used by the institution using Moodle.

This will require a hack to the code.

Email settings

Location: Administration > Server > Email

SMTP hosts: smtp.gmail.com:465 NOTE: Leave out the port (:465) in 1.9.2 or lower

SMTP username: Your email address @gmail.com or your own domain if using Google Apps

SMTP password: password for the above email account

Code Modification

In your Moodle site go to /lib/phpmailer/ and modify the following file:

class.smtp.php

Around line 83 DIRECTLY after the Connect function header, insert this line immediately after the "{" :

$host = 'ssl://' . $host;

Code Modification (1.9.2 or lower)

These two additional modifications need to be made in 1.9.2 or lower as the SMTP hosts setting above will not allow the port to be included.

class.phpmailer.php

around line 162

  • Change var $Port = 25; to var $Port = 465;

class.smtp.php

around line 30

  • Change var $SMTP_PORT = 25; to var $SMTP_PORT = 465;

Tips and tricks

  • Some sites may need the additional step of un-commenting the php_openssl.dll extension in php.ini.

Tips and tricks

Google Edu account

There is a possible issue with a Google Edu account. When an email goes out via Moodle, Google may change the reply to address to that of the Moodle sites general email.

Google education edition with 1.9.9

When using Google Education Edition with 1.99

The latest php mailer is paramont. If someschool.edu email at google is not accepting mails from the moodle as valid mails you need to create an SPF record at your host, allowing mail from the Central Mail server, Google and the local server which satisified Google's validation desires.

@ 14400 IN TXT "v=spf1 ip4:174.121.161.XXX include:aspmx.googlemail.com mx:c1.hostname.com ~all"

This bit is server side more than moodle so if you are on managed or shared hosting the server admin will have to do the record (try submitting a request to have the record added with full details of how and why to do so) then follow the previous the directions in this record.

See also

Email settings