haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.02k stars 662 forks source link

emails don't reach haraka #686

Closed ghost closed 10 years ago

ghost commented 10 years ago

I set up haraka as a proxy server to a Postfix server on another machine. I understand that I have to confiigure both Haraka and Postfix to recieve emails for the same domain name. So, I added an entry in host_list with the domain name of the Postfix machine, let's say email.myexample.com.But now the emails don't reach Haraka anymore. I also understand that for an email to reach haraka a MX record must exist pointing to haraka. So maybe that is why emails don't reach Haraka. If you think that is the case, what must the MX record contain?

smfreegard commented 10 years ago

Ok - here's an example configuration for domain example.com:

You would add example.com into config/rcpt_to.in_host_list and set-up Postfix to accept mail for the same (you're on your own here; I've never used Postfix myself).

Let's say Postfix is running on host 1111.222.333.444 on port 25; you add queue/smtp_proxy to your config/plugins file and set-up config/smtp_proxy.ini to use host 111.222.333.444 on port 25.

Let's say your Haraka machine has an external IP address of 444.555.666.777 and it has a public DNS hostname of haraka.example.com; so you would set the MX record for example.com to:

@ IN MX 10 haraka.example.com. haraka IN A 4444.555.666.777

smfreegard commented 10 years ago

I should probably also mention that you don't need an MX record to deliver a mail to a hostname (e.g. host.example.com) because if there is no MX record the A record is used as an implicit MX record.

ghost commented 10 years ago

if I'm sending and email to a user from postfix @ haraka's hostname, the mail arrives in haraka and in postfix, but if i'm sending it to an user from postfix @ postfix hostname , the mail arrives in postfix but without passing through haraka.

smfreegard commented 10 years ago

You could therefore add an MX record to the Postfix hostname pointed to the Haraka hostname e.g.

haraka IN A 4.5.6.7 postfix IN A 1.2.3.4 postfix IN MX 10 haraka

That should work - depending on your DNS configuration...

smfreegard commented 10 years ago

You would also have to add the Postfix hostname into config/rcpt_to.in_host_list as well as what you already have.