DNS Problem - Webserver not sending mail locally, using Google Mail instead

Hi Folks!

So im triyng to get php mail() working. (On a new webserver using virtualmin). Im not receiving any emails sent using the script and ubuntu's so i ran the below comand and as you can see its having problems connecting to google mail. (Were running this script on a server on our own network in a university.. There rather strict with there network so were assuming that port 25 outbound is restricted! Were waiting for a reply from them to confirm this and possible unblock it) [Mail is being sent to web@sinradio.co.uk)

sonar@radiosonar:~$ mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
DF20517C1C3      399 Wed Jan  6 22:37:53  www-data@radiosonar.solent.ac.uk
       (connect to ASPMX.L.GOOGLE.COM[]:25: Connection timed out)

-- 0 Kbytes in 1 Request.

I am however, trying to figure out why it is trying to connect to googles mail server to send mail when the DNS on the machine does not tell it too? See below the DNS..

Could this be my problem that it is trying to connect to google mail to send email? Or is this normal and ill have to try and get them to unblock it? :)

SONARTV.CO.UK DNS SERVER SETTINGS (That is all along with googles MX records)
Aliases:      Alias         Actual Domain Name
      sonartv.co.uk         radiosonar.solent.ac.uk
      *.sonartv.co.uk         radiosonar.solent.ac.uk
      mail.sonartv.co.uk         ghs.google.com
      www.sonartv.co.uk         radiosonar.solent.ac.uk


      Name       Type       TTL       Values
      sonartv.co.uk.       NS       Default       radiosonar.solent.ac.uk.
      sonartv.co.uk.       A       Default
      www.sonartv.co.uk.       A       Default
      ftp.sonartv.co.uk.       A       Default
      m.sonartv.co.uk.       A       Default
      localhost.sonartv.co.uk.       A       Default

      Name       Type       TTL       Values
      webmail.sonartv.co.uk.       A       Default
      admin.sonartv.co.uk.       A       Default
      mail.sonartv.co.uk.       A       Default
      sonartv.co.uk.       MX       Default       5 mail.sonartv.co.uk.
      sonartv.co.uk.       SPF       Default       v=spf1 a mx a:sonartv.co.uk ip4: ?a
Who is Participating?
Chris DentConnect With a Mentor PowerShell DeveloperCommented:

You might ask your IT guys (or whatever they are) if there's a mail system you can relay through. If they support this kind of thing there may well be.

If you do that you pass the mail onto the relay, and it sends it out to the recipient rather than your server doing all the work.

Chris DentPowerShell DeveloperCommented:

If the mail server is asked to send to sinradio.co.uk it will look up the MX record for that, then deliver according to the directions there.

Is the mail domain local to your network?

Srobinson08Author Commented:
Thanks for the reply!

However im not sure why its trying to connect to google to send mail? sureley it should be sending mail locally if the local DNS records tell it that the mailserver is local?

They are unable to unblock port 25 but are able to offer me another port.
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

Chris DentPowerShell DeveloperCommented:

Another port is no good unfortunately.

The records you've shown me up there don't account for sinradio.co.uk, you should be able to see where that would go with:

nslookup -q=mx sinradio.co.uk

Srobinson08Author Commented:
Ahh i see. Thanks! I may be in a bit of a pickle here then..
Ive sent a test email out to a few people and as you can see below it cannot connect because i cannnot get access through port 25.

Im using PHP Mail() which i assumed didnt using SMTP! Is there a way around this problem? :(

5F7D617C1E3      553 Thu Jan  7 18:33:57  www-data@radiosonar.solent.ac.uk
  (connect to ALT2.ASPMX.L.GOOGLE.COM[]:25: Connection timed out)

A8ED517C2C6      553 Thu Jan  7 18:33:57  www-data@radiosonar.solent.ac.uk
(delivery temporarily suspended: connect to mx4.hotmail.com[]:25: Connection timed out)

AD77217C2F6      558 Thu Jan  7 18:33:57  www-data@radiosonar.solent.ac.uk
          (connect to mx4.hotmail.com[]:25: Connection timed out)

0BC7917C1CB      558 Thu Jan  7 18:33:57  www-data@radiosonar.solent.ac.uk
           (connect to mx3.hotmail.com[]:25: Connection timed out)
Srobinson08Author Commented:
Hmm that will be fun! Id like to know what they are aswell sometimes!

Thanks for the help. If all else fails ill send a nice POST to another webserver using HTTPS!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.