Home » Linux OS and Software » How-To » Relay mail from Web server to mail server
Wed, 24 November 2010 06:59 Go to next message
Registered: November 2010
Messages: 4
Hi All

I have been struggling with this for some time now and need some help

I have two semi-dedicated servers here at VPSville one running my webserver and one running my mail server, I want all mail from feedback forms and the webserver to be delivered to the mailserver. The fist problem I had was that it saw all the domains as local domains even though their MX record pointed to the mailserver. I think I have solved that, but now the mailserver rejects the relay from the webserver.

I have setup postfix on both with the following on the web server to stop local delivery and relay mail:

main.cf
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
myorigin = $mydomain
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8
relayhost = mail.matthouldsworth.com
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /var/lib/sendmail
mailq_path = /usr/bin/mailq



master.cf - default but commented out the local delivery line

I then get the following in the mail logs on the web server:


Nov 24 11:49:30 digitalquill postfix/smtp[11678]: 3B16B1FF46F3: to=<Office@digitalquill.co.uk>, relay=none, delay=490, delays=460/0.01/30/0, dsn=4.4.1, status=deferred (connect to mail.matthouldsworth.com[77.74.199.21]:25: Connection timed out)

A telnet to the mail server from the web server times out:

telnet mail.matthouldsworth.com 25


I have added the ip addresses of the webserver to the mynetworks in main.cf


lsof -i :25 on the mail server gives:

root@mail:/etc# lsof -i :25
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
master 16170 root 12u IPv4 373618056 TCP *:smtp (LISTEN)
smtpd 18231 postfix 6u IPv4 373618056 TCP *:smtp (LISTEN)
smtpd 22174 postfix 6u IPv4 373618056 TCP *:smtp (LISTEN)
smtpd 22211 postfix 6u IPv4 373618056 TCP *:smtp (LISTEN)

so it is listening on port 25

I do not think I have any firewalls, IPtables is not installed

Any help would be great, Am I totally up the wrong path here?

Thanks

Matt Houldsworth

Wed, 24 November 2010 11:52 Go to previous messageGo to next message
Registered: November 2010
Messages: 4
looking into this a little more and some form of DNS issue???

I have noticed that there is an issue with pinging, so is this a firewall issue or a DNS issue?

My /etc/resolv.conf is the standard vpsville one

From the Web server (Matthouldsworth.com)

ping google.co.uk - success - normal ping results
ping localhost - Success - normal ping results
ping matthouldsworth.com success but very slow and only seems to do one packet no matter how long I leave it
Ping mail.matthouldsworth.com - either get unknown host or all packets lost

From the mail server (mail.matthouldsworth.com)

ping google.co.uk - success - normal ping results
ping localhost - Success - normal ping results
ping matthouldsworth.com I get 'From mars.vpsville.co.uk (94.229.66.6) icmp_seq=1 Destination Host Unreachable'
Ping mail.matthouldsworth.com - normal ping results

Anyone any thoughts?
Wed, 24 November 2010 18:20 Go to previous messageGo to next message
Registered: November 2007
Messages: 504
That looks like a DNS issue.

At your DNS, make sure you have separate 'A' entries for mail and a wildcard for the domain.

Once you can ping mail from your webserver, you can send to it normally without any relay issues. Just have your forms connect to it via SMTP with full authentication and create a mail account for your webserver to use.

Thu, 25 November 2010 03:59 Go to previous messageGo to next message
Registered: November 2010
Messages: 4
staff wrote on Wed, 24 November 2010 18:20



At your DNS, make sure you have separate 'A' entries for mail and a wildcard for the domain.






Thanks for the reply, how do I do that? in the /etc/resolv.conf?

If you mean the A record on the domain, the domains are set-up correctly with the A record pointing to the web server and the MX pointing to the mail server

Matt
Thu, 25 November 2010 04:40 Go to previous messageGo to next message
Registered: January 2009
Messages: 62
You need an A record for the mail server as well. And then wildcard everything else.

Also, confirm in your email server config that www is allowed to relay through mail.
Thu, 25 November 2010 05:28 Go to previous messageGo to next message
Registered: November 2010
Messages: 4
I am probably being dense here with several schoolboy errors and assumptions, but why do I need an A record going to the mail server?

Mail.matthouldsworth.com has both its A and MX records going to the mail server

Matthouldsworth.com has its A record going to the web server and its MX record going to the mail server

Is this not the right configuration?

Matt
Sat, 27 November 2010 03:22 Go to previous message
Registered: January 2009
Messages: 62
That is the ok. Of more importance is the mail server allowing the other machine to relay. Check that.
Previous Topic:VPN setup for Boxee Box?
Next Topic:REMOTE DESKTOP ON UBUNTU 10.04
Goto Forum:
  


Current Time: Thu Jun 22 18:13:04 EDT 2017
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2006 FUD Forum Bulletin Board Software