# Postfix not receiving mail

## craftyc

When I send mail to username@subdomain.mydomain.com via the email address my ISP gave me, it never gets delivered. I have gone through the Desktop Configuration guide to the word, have searched around but still no joy.

Could somebody please help me sort out this problem. Thank you.

----------

## delta407

1. Is postfix running?

2. Can you connect to postfix? (telnet my.static.ip.address 25)

3. Is postfix set up as an MX for your target domain? (nslookup/dig your domain)

4. ...

More information, please.

----------

## craftyc

 *delta407 wrote:*   

> 1. Is postfix running?
> 
> 2. Can you connect to postfix? (telnet my.static.ip.address 25)
> 
> 3. Is postfix set up as an MX for your target domain? (nslookup/dig your domain)
> ...

 

1) Yes, along with courier-imap (ssl). The Postfix docs said that it (or some other ones) is needed to recieve mail.

2) Confusingly, no. I have setup my firewall correctly to accept connections. The Shields-Up test shows the port as "Closed"

3) Huh...  :Confused: 

4) Anything else?

PS This is the first time I'm setting up any kind of server, so go easy on me please.

----------

## abhishek

 *delta407 wrote:*   

> 1. Is postfix running?
> 
> 2. Can you connect to postfix? (telnet my.static.ip.address 25)
> 
> 3. Is postfix set up as an MX for your target domain? (nslookup/dig your domain)
> ...

 

To number 3, i dont think it wouild have to be. If there is no MX record mail should just go the the comp u have.

----------

## delta407

First you have to make sure that your SMTP port is connectable from the outside. Then, you have to set up your DNS records for the target domain to forward mail to your server.

Basically, when a mail server receives mail for mydomain.com, it asks it's local friendly DNS server for routing information. This is stored in MX (Mail eXchange) records, which determine what mail server should accept mail for mydomain.com. You can get nslookup and/or dig by running "emerge bind-tools", and you can look up your MX records as follows:

```
$ nslookup

Note:  nslookup is deprecated and may be removed from future releases.

Consider using the `dig' or `host' programs instead.  Run nslookup with

the `-sil[ent]' option to prevent this message from appearing.

> set type=mx

> mydomain.com

Server:         my.local.dns.server

Address:        my.local.dns.server#53

mydomain.com    mail exchanger = 1800 m1.dnsix.com.

mydomain.com    mail exchanger = 1800 m.dnsix.com.
```

Or:

```
$ dig mydomain.com mx

; <<>> DiG 9.1.3 <<>> mydomain.com mx

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14123

;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 6

;; QUESTION SECTION:

;mydomain.com.                  IN      MX

;; ANSWER SECTION:

mydomain.com.           86308   IN      MX      1800 m.dnsix.com.

mydomain.com.           86308   IN      MX      1800 m1.dnsix.com.

... more stuff ...
```

my.fully.qualified.domain.name should be listed as an MX for mydomain.com.

----------

## craftyc

I should also have mentioned that if I send an email to username@my.fully.qualified.domain.name from root@my.fully.qualified.domain.name, I receive the e-mail.

Here is the output of dig.

```
chandegra root # dig chandegra.homelinux.com mx

; <<>> DiG 9.2.1 <<>> chandegra.homelinux.com mx

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62384

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:

;chandegra.homelinux.com.       IN      MX

;; AUTHORITY SECTION:

homelinux.com.          1800    IN      SOA     ns1.dyndns.org. hostmaster.dyndns.org. 2001580359 10800 1800 604800 1800

```

----------

## delta407

 *craftyc wrote:*   

> I should also have mentioned that if I send an email to username@my.fully.qualified.domain.name from root@my.fully.qualified.domain.name, I receive the e-mail.

 

Okay, that means postfix is routing locally without problems.

 *craftyc wrote:*   

> 
> 
> ```
> chandegra root # dig chandegra.homelinux.com mx
> 
> ...

 

Well, if your mail server resides at chandegra.homelinux.com, then everything should be okay, as long as inbound connections are forwarded properly.

----------

## craftyc

 *delta407 wrote:*   

> 
> 
> Well, if your mail server resides at chandegra.homelinux.com, then everything should be okay, as long as inbound connections are forwarded properly.

 

How do I do that???  :Embarassed: 

I have set my (Linksys BEFSR41) router to forward the necessary ports to the right place. Is there anything else that needs to be done?

Thanks.

----------

## delta407

 *craftyc wrote:*   

> I have set my (Linksys BEFSR41) router to forward the necessary ports to the right place.

 

Well, if port 25 is forwarded inbound then you should be good. I would make sure your hostname is a FQDN (fully-qualified domain name; i.e. ping will resolve to your external IP), since that's a Good Thing for mail servers to do.

Additionally, I would make sure postfix is accepting SMTP connections at all (telnet localhost 25), and then that postfix is accepting SMTP connections from the outside world (uhh... check the man pages).

----------

## aardvark

But if your isp does not forward port 25 as in my case (spam reduction) , what do you do then? Ask them to make an mx record for your mailserver?

In my case, which look equal the the one of the topicstarter, it is impossible to get mail delivered to my server from outside the domain of the isp... or at least I think so. DO I understand correctly that the ISP has to make an mx record on their dns?

----------

## delta407

 *aardvark wrote:*   

> But if your isp does not forward port 25 as in my case (spam reduction) , what do you do then?

 

Then you're pretty much screwed. If your ISP is blocking port 25 to all its clients, no DNS magic will help you. Really, you have three options: one, use someone else to be your e-mail server; two, have a computer on another network accept mail for you and route it to your IP on a different port; three, switch ISPs.

SMTP expects the remote server to be on port 25; if you can't get port 25, you can't get inbound mail directly.

----------

## MoonWalker

Hi!

Can I jump in here and take part of your expertice delta? I'm setting up postfix as well right and have a slightly different problem and have searched postfix mail achive for hours without finding a solution. I have it up working ok except for one detail. I have several domains setup using virtual_maps as an example:

posthost.biz virtual

joakim@posthost.biz joakim

kamila@posthost.biz kamila

$myhostname = ns1.astrocalc.net

$mydomain = astrocalc.net

.... etc.

Problem is when I from a webmail account send a mail to kamila@posthost.biz

it shows up in mail log as kamila@astrocalc.net and joakim@posthost.biz even comes through prepended with an other of my local usernames netjosch@astrocalc.net

I wonder if this possibly can have to do the way I have set up MX for the virtual or alias domains? Here's a dig...

```
root@ns1 joakim # dig posthost.biz mx

; <<>> DiG 9.2.1 <<>> posthost.biz mx

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58275

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:

;posthost.biz.                  IN      MX

;; ANSWER SECTION:

posthost.biz.           38400   IN      MX      10 cms.posthost.biz.

;; AUTHORITY SECTION:

posthost.biz.           38400   IN      NS      ns2.astrocalc.net.

posthost.biz.           38400   IN      NS      ns1.astrocalc.net.

;; ADDITIONAL SECTION:

cms.posthost.biz.       38400   IN      A       212.3.10.152

ns1.astrocalc.net.      38400   IN      A       212.3.10.145

;; Query time: 5 msec

;; SERVER: 212.3.10.145#53(212.3.10.145)

;; WHEN: Wed Jul 17 04:40:59 2002

;; MSG SIZE  rcvd: 131
```

should I be better to use the astrocalc.net MX? 

crafty, if you don't find as local solution for your mx dilema I can host you an MX for a while (if that is possible, I geuss so as I run my own dns  :Smile:  not being force to rush for a working solution. Only condition - no spam sending.

/Joakim

/

----------

## delta407

It sounds like Postfix is receiving the mail, so your MX configuration is fine. AFAIK no MTA gets confused if the return on an MX record is not the same as theh hostname the remote MTA gives out. So, as long as that MX in turn resolves to your IP, you should be good.

----------

