項目換到moodle平臺了,今天我們來研究一下moodle的發信機制,
首先,我存在的問題是,新用戶註冊了以後,收不到確認信,好像moodle和drupal在這方面差別還挺大的,我們先在moodle.org裏面找一下smtp設置。
很快找到了一篇關於gmail的smtp服務設置的帖子,以下是原文,轉自moodle.org
Email setup gmail
From MoodleDocs
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.
Contents[hide ] |
[edit ] 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
[edit ] Code Modification
In your Moodle site go to /lib/phpmailer/ and modify the following file:
[edit ] class.smtp.php
Around line 83 DIRECTLY after the Connect function header, insert this line immediately after the "{" :
$host = 'ssl://' . $host;
[edit ] 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.
[edit ] class.phpmailer.php
around line 162
- Change var $Port = 25; to var $Port = 465;
[edit ] class.smtp.php
around line 30
- Change var $SMTP_PORT = 25; to var $SMTP_PORT = 465;
[edit ] Tips and tricks
- Some sites may need the additional step of un-commenting the php_openssl.dll extension in php.ini .
因爲我的版本是1.9.9,忽略了後面的兩個文件修改, 簡單設置了以後,試着註冊了一個新用戶,check 郵箱了以後,成功收到郵件,搞定!
Hi user A,
A new account has been requested at 'selfleader_Test'
using your email address.
To confirm your new account, please go to this web address:
http://localhost/moodle/login/confirm.php?data=oQ6ALblnAD22el0/user
In most mail programs, this should appear as a blue link
which you can just click on. If that doesn't work,
then cut and paste the address into the address
line at the top of your web browser window.
If you need help, please contact the site administrator,