Difference between revisions of "Email setup gmail"

Jump to: navigation, search
(Steps in site administration block: link to page on email settings)
(cleanup)
Line 1: Line 1:
Google's gmail can be set up as an email processor for Moodle.  This is reduces or eliminates the need for an email service on a server. For example: when Moodle is used to train new developers/staff.
+
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 [http://www.google.com/apps/ Google Apps] is used by the institution using Moodle.
  
 
This will require a hack to the code.
 
This will require a hack to the code.
  
== Steps in site administration block ==
+
== [[Email settings]] ==
In the site administration block>Server>[[Email settings]]for smtp host use:
+
Location: ''Administration > Server > [[Email settings|Email]]''
smtp.gmail.com
 
My @theseventhsungame.net email (Use Gmail domains)
 
Password should be set to the above email's .
 
  
==Steps for code hack==
+
'''SMTP hosts:''' smtp.gmail.com:465  ''NOTE: Leave out the port (:465) in 1.9.2 or lower''
On the Moodle site go to  /lib/phpmailer/ and modified the following files:
 
  
class.phpmailer.php
+
'''SMTP username:''' Your email address @gmail.com or your own domain if using Google Apps
around line 162
+
 
*Change var$Port =25; to 465
+
'''SMTP password:''' password for the above email account
 +
 
 +
== Code Modification ==
 +
On the Moodle site go to <tt>/lib/phpmailer/</tt> and modified the following files:
  
class.phpmailer.smtp
+
=== class.smtp.php ===
around line 30
+
Around line 83 DIRECTLY after the '''Connect''' function header, so the next line after the { add:
*Change var $SMTP_PORT = 25; to 465
+
$host = 'ssl://' . $host;
  
class.phpmailer.smtp file
+
== Code Modification (1.9.2 or lower) ==
around line 83 DIRECTLY after the Fucntion header, so the next line after the {
+
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.
add:
 
*$host='ssl://' . $host;
 
  
== Completed ==
+
=== class.phpmailer.php ===
This setup will allow Gmail to work with for example:
+
around line 162
 +
*Change <tt>var $Port = 25;</tt> to <tt>var $Port = 465;</tt>
  
http://www.theseventhsungame.net
+
=== class.smtp.php ===
http://www.theseventhsungame.net/tssuniversity
+
around line 30
 +
*Change <tt>var $SMTP_PORT = 25;</tt> to <tt>var $SMTP_PORT = 465;</tt>
  
 
== Tips and tricks ==
 
== Tips and tricks ==
  
* Some sites may need an additional step to Un-comment the php_openssl.dll extension in php.ini.
+
* Some sites may need an additional step to un-comment the '''php_openssl.dll''' extension in <tt>php.ini</tt>.

Revision as of 04:01, 21 August 2008

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

On the Moodle site go to /lib/phpmailer/ and modified the following files:

class.smtp.php

Around line 83 DIRECTLY after the Connect function header, so the next line after the { add:

$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 an additional step to un-comment the php_openssl.dll extension in php.ini.