Email for subdomains

Email for subdomains

by Jason Touw -
Number of replies: 17

We are running Moodle v3.0.  Google has been little help here and I am wondering if anyone else has experienced this.  Event reminders, Registration emails, Forum subscriptions are going out fine to faculty and staff on our domain "jdoe@sitedomain.org".  

However, students have the subdomain, "jdoe@students.sitedomain.org"  None of those emails seem to be going through.  Google told us it was that the php in Moodle needed to be edited to allow subdomains...and that's as far as Google support went on this (I'm figuring Moodle is not their product and Classroom is so not much help).  In the restricted email settings on the Site Admin side all fields are blank (allows all emails).

I have no idea what which php to edit or what the line change should look like (if that's even the case).  Rather frustrating as you can imagine.


Average of ratings: -
In reply to Jason Touw

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

This problem is as broad as it is deep!  Especially when given generic/false domains.

Reference for Google Edu Domains and similar setup:
https://groups.google.com/forum/#!topic/k12appstech/VvIJCEwvYiY

That, discusses only the Google end.

Moodle is not a mail application ... dedicated to just Email.   It attempts to
use Email services dependent upon how it's been configured.
Two options: Moodle uses PHP Mailer (a well known and widely used add-on to many
open sourced projects.
https://github.com/PHPMailer/PHPMailer/ )

These forums use it in initial 'packaging' of a message and the sending process.
Check the header of a message you get from this forum and you'll see
X-Mailer value.

OR

An SMTP server.  Moodle sends ALL outgoing mail to that SMTP server and it
relays the mail.

Do you have an SMTP set up on your Moodle?
Is that SMTP server setup a google smtp server?
Can you share those setting (hiding logins/password anything internal).

There is a testing option for mail delivery.
https://moodle.org/mod/forum/discuss.php?d=322747
https://moodle.org/plugins/local_mailtest

I'll volunteer to do some leg work for you in checking your domains
for valid MX, DKIM, SPF records in DNS if you'd care to share the real
domains ... not specific addresses ... just the domains.  Those are NOT an international secret! ;)
In a former life, I provided core services for some 30+ schools in a private network involving DNS, EMail, EMail gateways, etc. and have had to 'slueth' issues before.  Not fun, but doable.

I don't think that you need to hack any code to get this to work.
(could be wrong!)

'spirit of sharing', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: Email for subdomains

by Jamie Kramer -

I was going to say something along the same thing but you pretty much encompassed what I would say and then some. I didn't know about the mailtest plugin, thanks! I have been thinking about developing such a thing but hadn't gone searching for this.

As was stated already, it may be that the student sub-domain does not have SPF, DKIM, and DMARC set up such that the email server can "trust" the email being sent. So I would agree that is a natural starting point in this process.

If you happen to use the email test plugin, and you get a bunch of debug output, that output might give you an exact reason why the email is getting rejected.



In reply to Ken Task

Re: Email for subdomains

by Jason Touw -

OK...Installed the mail test.  When I tried the test email to a students.sitedomain.org account, Moodle says the message was delivered properly to the SMTP server.




So, I sent myself an email test message and this is what I received:



However, when I logged into a students.wvcsd.org account, there is no email received.  Any idea where the breakdown is?  Recall, we had Moodle on a different server running 2.8.1 with a different domain and the emails were being delivered and received fine.

In reply to Ken Task

Re: Email for subdomains

by Jason Touw -

Hi Ken,

I didn't forget about you on this thread.  As Spring has progressed, so has the workload for us teachers.  I may actually have some time to work on this starting next Monday...school isn't out, but one of my sections is taking their final on Monday, so thing will lighten up a bit.

I will send you the domains on a separate thread.

Thanks!

In reply to Ken Task

Re: Email for subdomains

by Jason Touw -

Well after a long time of no success with this, we have moved forward a bit.  Our IT engineer was on the phone with Google for two hours, and they determined that the emails were not authenticated properly.  We changed the config on the DNS as follows:


wvcsd.org. IN TXT 

;ANSWER 

wvcsd.org. 1973 IN TXT "v=spf1 include:_spf.google.com include:customerspf.schoolmessenger.com ip4:xx.xxx.xxx.xx ip4:xx.xxx.xxx.xx/27 ~all" 

wvcsd.org. 1973 IN TXT "google-site-verification=XA0GAgs_9d0QuKXzAFgzx_I9Pn1Qi0KsNc2mRQ_lEQM"

I omitted the IP address for security purposes.

Google now says the emails are authenticated, but are not being delivered to subdomains.  Any thoughts on where we are with this?  Does anyone have a subdomain email that I could send a test message to outside of my organization?

Thanks!

In reply to Jason Touw

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

Dunno that it will help ... hopefully ...

have you seen/read:

https://support.google.com/a/answer/2640542?hl=en

There's also a tool to help:

https://toolbox.googleapps.com/apps/main/ (the Mail)

One more resource .... since you appear to be the Admin of ISD's Google Domain ..

Community for Google Apps Administration.

https://plus.google.com/u/0/communities/113701248093302177514

Have to ask to join.

'spirit of sharing', Ken


In reply to Jason Touw

Re: Email for subdomains

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Jason

What is this talk about Google? Have you submitted your soul, mind and freedom them?
sad

So, the question is, your Moodle sends mail to anybody@sitedomain.org but not to anybody@students.sitedomain.org, right?

The obvious question is, how does it send mail? What are in the fields Site administration > Plugins > Message outputs > Email: SMTP hosts, SMTP security, SMTP username and SMTP password? Obviously you need to anonymize confidential data.

> I have no idea what which php to edit or what the line change should look like (if that's even the case). Rather frustrating as you can imagine.

You do _not_ change Moodle code for routine things, you set its parameters through the web GUI!
In reply to Jason Touw

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

What do you get for a dig query like this ... substitute your students domain:

The 8.8.8.8 is Googles resolver.

How about your own DNS resolvers/DNS servers?
[root@moodle ktask]# dig stu.yourdomain.net ANY @8.8.8.8

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.6 <<>> stu.yourdomain.net ANY @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50364
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;stu.yourdomain.net.            IN    ANY

;; ANSWER SECTION:
stu.yourdomain.net.        21599    IN    SOA    ns1.yourdomain.net. someaddy.mailhost.yourdomain.net. 22620140 10800 3600 604800 86400
stu.yourdomain.net.        21599    IN    NS    ns1.yourdomain.net.
stu.yourdomain.net.        21599    IN    NS    ns2.yourdomain.net.
stu.yourdomain.net.        21599    IN    MX    10 aspmx.l.google.com.
stu.yourdomain.net.        21599    IN    MX    20 alt1.aspmx.l.google.com.
stu.yourdomain.net.        21599    IN    MX    30 alt2.aspmx.l.google.com.
stu.yourdomain.net.        21599    IN    MX    40 aspmx2.googlemail.com.
stu.yourdomain.net.        21599    IN    MX    50 aspmx3.google.com.

The other thing ... IPv6 ... google would like *everyone* to use it.

Is your Moodle talking IPv6 correctly?   Can it find the IPv6 gateway for your network?

/sbin/ifconfig

will show a line that shows the IPv6 address of your server:

inet6 addr: [won't share it]

'spirit of sharing', Ken


In reply to Ken Task

Re: Email for subdomains

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken

You wrote:
> dig stu.yourdomain.net ANY @8.8.8.8

Why does it have to be the Google's DNS server? Why is the OP's default DNS server insufficient?
In reply to Visvanath Ratnaweera

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

Obviously, the DNS queried doesn't have to be Googles open DNS, but rather than get into the depth of that (ie, local DNS) the query would return what the local DNS records/setup would contain anyway.  

Some school networks have internal DNS servers that are authortative for the internal domain (corp.lan corp.wan ... whatever you want it to be cause it's NOT supposed to be queried by any server/workstation NOT connected to the LAN/WAN.   Same DNS server has their external public outside domain - the one registered ... someisd.net, stu.someisd.org.   A messed up Windows DNS server (have seen them) might get the internal zones mixed up with external zones .. ie, not keep them in a 'split' setup.

When moving mail for an existing domain to Google there is a process.  Domain owner has to prove they own the domain first.   After that, one can acquire the DNS records one should plug into local DNS servers.   What one sees from the query of Google's DNS should be the same as entered into the local DNS.   In the local DNS, for mail records, are in the outside/public zone and inside computers need to be able to make queries of that split public zone to find their mail.   Same is true of internal servers, like Moodle.

That explain? ;)   Since we've not heard back from op either the problem has been resolved or ????

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Email for subdomains

by Jason Touw -

Hi Ken...not resolved, just dissecting the long (and wonderful) string of suggestions that came through.  We are on a President's weekend break here so I have been hit or miss online.  I am looking through the settings now, and you mentioned that you might be able to assist a little more...perhaps with an RDP, which I am not opposed to.

The domain is wvcsd.org and the subdomain is students.wvcsd.org.  Not top secret at all.


In reply to Jason Touw

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

President's Day here as well. ;)

Really wasn't 'fishing' for anything more formal (RDP or otherwise) - if you are not supposed to do it, don't!

Will respond to the PM you've sent in PM and even though the information gathered from the domains shared anyone could find out with a query, I'll also continue the discussion/cussion in PM or in direct contact EMail.

This forum is for Moodle and there are many who really aren't interested in discussing Google Mail, etc. although *IF* I had enough $ I'd join Moodle Association and see what could be done addressing such issues as there are many schools now using Google for many things .. Google Docs/Drive, EMail, etc..  IMHO, Moodle is 'loosing market share' in the PK12 arena - which I believe is larger than any other educational institution division, etc.   But, I digress ... so off to PM. ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: Email for subdomains

by Jason Touw -

Long time, no talk about this issue.  Well some has changed and then again some has not.

What has not changed:  Emails to students still not being delivered.

What has changed:  I now have a test "dummy" student account to troubleshoot this further.  

What else has changed:  We are running the correct install of Moodle v3.0.3 for Windows and using MariaDB and IIS.  Turned out, we were running a windows build that used Apache and MySQL which is NOT recommended on a Windows Server.  Now it runs like a top!  

What else:  Our internet gateway no longer goes through a regional education center, instead we have a direct connection to the internet.

I am wondering if anyone would be willing to offer some advice on where to start to find out why emails from Moodle do not reach our student accounts (@students.sitedomain.org), but do go to faculty (@sitedomain.org) and do go to any other email (yahoo, gmail, aol, outlook, etc.).  School starts for us in one month so now is a good time to try to get to the bottom of it.

Thank you!

In reply to Jason Touw

Re: Email for subdomains

by Dave Perry -
Picture of Testers

Moodle / MySQL / Apache under Windows may not be recommended, but we find it more stable than IIS.

Can't comment on the rest of the stuff, but just placing on record that a properly setup config with Apache is a lovely thing.

In reply to Jason Touw

Re: Email for subdomains

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You haven't said how your email is setup...are you using an smtp server?  If so, have you looked at the settings in your smtp server?  Perhaps that is where the block is.  The fact that you are receiving mail means that Moodle is sending it.  So, others are correct when they state that this is not a moodle issue.

In your messaging settings, have you selected to the option to send all emails from the noreply address?  This often stops issues with email servers rejected emails because there is a discrepancy between the sender and the return address.  Gmail and Yahoo have notorious about blocking certain moodle emails when this option is not selected.  

In reply to Emma Richardson

Re: Email for subdomains

by Ken Task -
Picture of Particularly helpful Moodlers

If the addresses are now under a Google for Education domain there is also some items one might need to change/add on the google end of things.    Dunno what those are exactly, but Google folks would be able to help there.

'spirit of sharing', Ken