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

Posted on 2010-01-06
Medium Priority
Last Modified: 2013-11-30
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
Question by:Srobinson08
  • 3
  • 3
LVL 71

Expert Comment

by:Chris Dent
ID: 26198004

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?


Author Comment

ID: 26202271
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.
LVL 71

Expert Comment

by:Chris Dent
ID: 26202305

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

What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.


Author Comment

ID: 26202974
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)
LVL 71

Accepted Solution

Chris Dent earned 260 total points
ID: 26203027

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.


Author Comment

ID: 26203068
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!

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wrote this article to explain some important DNS concepts that should be known to avoid some typical configuration errors I often see in forums. I assume that what is described here is the typical behavior of Microsoft DNS client. I don't know …
We aren’t perfect, just like everyone else.  Check out the email errors our community caught and learn the top errors every email marketer should avoid.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 2 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question