email problem

email problem

by Mark Stevens -
Number of replies: 6
Hi All,

We recently installed Moodle onto a recent version of SuSe, and we're getting an fsockopen error.  This error has been mentioned 8 times in the using moodle forum, but never answered. 

I've tried leaving the config mail fields blank, but no mail or error message is sent. (There does appear to be one message waiting in the mail queue.)  If I understand moodle correctly, it uses sendmail as the default?  We were apparently unable to install sendmail due to an alleged incompatibility issue with postfix.

Any help would be greatly appreciated.  I don't want to manually add users smile

Thanks in advance,
Mark Stevens
Average of ratings: -
In reply to Mark Stevens

Re: email problem

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You shouldn't need to install Sendmail. Postfix has a sendmail wrapper that makes postfix *look* like sendmail to any applications that expect the sendmail API. It should 'just work', but that doesn't mean to say that your machine has the connectivity to get the mail out due to your local firewalls etc.

The first step is to make sure you mail works at all. Can you send a message using the 'mail' command at the command line? If not you will need to find an accessible SMTP server and fill that in, in the mail field.

Failing that, when *exactly* do you see the fsockopen error, and can you post the complete error. Have you checked the apache error log to see if there is any more information to be had in there?
In reply to Mark Stevens

Re: email problem

by Gustav W Delius -

One easy solution if you don't want to have a mail server running locally is to use some external mail server. For example you could create yourself an account with yahoo or a similar free service and then use their mail server.

Perhaps you have been put off from trying this by the text next to the smtp server setting on the configuration page which says: "Give the full name of one or more local SMTP servers that Moodle should use to send mail". I think the "local" should be taken out of that sentence because the SMTP server does not have to be local.

In reply to Gustav W Delius

Re: email problem

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Gustav,

I am going to disagree with you slightly - the SMTP server in 99% of cases *will* be local. To prevent relaying most SMTP servers only allow connections to be made from the local network. The exception is those that require authorization, but I have actually yet to see such a server in a production environment.

With most Linux distros you only get a minimal mail setup out of the box. I wouldn't say that you are strictly speaking running a mail server as they usually don't accept mail. The postfix/sendmail setup will send mail though - if it can. Most institutions of any size tend to firewall outgoing mail except fro authorized machine to prevent spamming and other problems. In this case you would find that your machine can send to internal addresses but not external - probably not what you wanted.
In reply to Mark Stevens

Re: email problem

by Greg Fishbone -
We're having an email problem as well since upgrading from 1.2.1 to 1.3 beta+.  Before the upgrade, email was working perfectly, now it's not working at all.  Any suggestions on what might be going on?

--Greg
In reply to Mark Stevens

Re: email problem

by Bryan Williams -

Mark,

Have you set up a cron job to call moodle/admin/cron.php (every 5 minutes or so)? You can call this script in the browser and if it sends any mail in queue, that may be all that's wrong.  The command line for crontab should look something like this:
wget -q -O /dev/null http://yoursite.com/moodle/admin/cron.php on Linux.

If you have a mail server set up and running ok, leave smtphost: and other config fields blank. If this still doesn't work, something in PHP may not be set up correctly.

In reply to Bryan Williams

Re: email problem

by Greg Fishbone -
Thanks, Bryan.

I loaded the chron.php file and it sent out the whole backlog of forum emails, so I know there's no problem the sendmail program and PHP.  I tried to set up a cronjon to run the line you gave every five minutes.  Hopefully that will work too. 

--Greg