1

Topic: SMTP Server for each Domain

==== Required information ====
- iRedMail version: v0.4.1 (LDAP)
- Store mail accounts in which backend : LDAP and MYSQL (2 Servers same issue
- Web server (Apache or Nginx): Apache
- Linux/BSD distribution name and version: Debian GNU/Linux 7.8 (wheezy)
- Related log if you're reporting an issue: x
====

Hello

I cant find a way to send mails from one Domain to a specified SMTP server.
(like Thunderbird each mail account can have its own SMTP server configured)
I am looking for a similar thing. I found this
http://www.iredmail.org/docs/ldap.add.mail.list.html
But i don't know if this is what i am looking for.

Explanation:

I have 4 Domains each with a different SMTP Server.
At the moment we use the SMTP Server from our provider configured in Thunderbird.
But for the future we would like to use our mail server as SMTP for more flexibility.

I have 2 Servers one with LDAP and with MYSQL. both have this issue.
Any help appreciated.

thx in advance

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: SMTP Server for each Domain

I'm afraid that i don't understand what your issue is. sad

3

Re: SMTP Server for each Domain

You mean use your server to forward to your Provider's SMTP Service but each of your domains would forward to a different SMTP Provider?

4

Re: SMTP Server for each Domain

ZhangHuangbin wrote:

I'm afraid that i don't understand what your issue is. sad

Thank you very much. I try to explain it so it makes more sense.

The goal is to set a different SMT server for each domain on my local mail server.
For example. If i have 4 Domains = 1D 2D 3D 4D
I would like to have:

1D SMTP smtp.1und1.x
2D SMTP gmail
3D SMTP yahoo
4D SMTP ip-adress

This i wold need for LDAP and MYSQL

5

Re: SMTP Server for each Domain

This is a feature in iRedAdmin-Pro, but you should be able to set the domain transport value manually to smtp:[example.com]:25 within your database (in sql it's vmail.domain.transport)

6 (edited by neozimpi@gmail.com 2015-04-08 15:42:29)

Re: SMTP Server for each Domain

7t3chguy wrote:

You mean use your server to forward to your Provider's SMTP Service but each of your domains would forward to a different SMTP Provider?

Yes.

Since we have no static address we will be black listed .. etc.

Thank

Me and my long descriptions ^^
I am not good at explaining things.

7

Re: SMTP Server for each Domain

Dynamic IP I think you mean, check my other reply it should work for you

8

Re: SMTP Server for each Domain

7t3chguy wrote:

This is a feature in iRedAdmin-Pro, but you should be able to set the domain transport value manually to smtp:[example.com]:25 within your database (in sql it's vmail.domain.transport)

We use LDAP. Hope there is also a way to do it.

9

Re: SMTP Server for each Domain

There is definitely possible as iRedAdmin-Pro can do it, you'll have to wait for ZhangHuangbin to tell you how to do it manually

10

Re: SMTP Server for each Domain

Sorry, i still don't fully understand what your problem is, but i guess i know it. I try to explain:

*) You're going to host 4 domains on one mail server, but these mail domains are hosted on other mail servers right now (gmail, yahoo, ...), right?

*) And you want to send email with your mail server, but sent emails must be arrived in the mailbox hosted on Gmail/Yahoo/..., right?

It sounds like per-domain transport setting. You can try this tutorial:
http://www.iredmail.org/docs/per-account.transport.html

11 (edited by neozimpi@gmail.com 2015-04-08 20:34:39)

Re: SMTP Server for each Domain

ZhangHuangbin wrote:

Sorry, i still don't fully understand what your problem is, but i guess i know it. I try to explain:

*) You're going to host 4 domains on one mail server, but these mail domains are hosted on other mail servers right now (gmail, yahoo, ...), right?

*) And you want to send email with your mail server, but sent emails must be arrived in the mailbox hosted on Gmail/Yahoo/..., right?

It sounds like per-domain transport setting. You can try this tutorial:
http://www.iredmail.org/docs/per-account.transport.html


Thanks i think that what i need.

The description for LDAP wasnt really helpfull. Could you explain the steps?
how can i change this?
Can i do it in phpldapadmin? Since i am not familiar with LDAP this is my best hope.

I found the MTA transport in Domains / domain names /  [ mtaTransport ] with value "dovecot".

If this is right and i have edit this for 1and1 how do i have to authenticate? Is there no login or authentication needed in peer domain transfer?

thx in advance

12

Re: SMTP Server for each Domain

Change the domain attribute mtaTransport using any ldap editor to the format I mentioned above. The attribute is currently dovecot so look for that

13

Re: SMTP Server for each Domain

7t3chguy wrote:

Change the domain attribute mtaTransport using any ldap editor to the format I mentioned above. The attribute is currently dovecot so look for that

hm.. great. since i never worked with LDAP i am pretty much in the dark.
At the Moment my default tool is phpldapadmin.

I didnt quit understand if i have to replace the value "dovecot" or if i can edit this.
but it makes no sense for me to replace the MTA dovecot. Cause this would mean
surely that no messages would be transmitted anymore. right?

I am a bit confused and not happy about working with LDAP.
Hope i get it done somehow.

14

Re: SMTP Server for each Domain

Oh you mean outgoing accounts will use offsite "smarthosts"
that is much trickier and will require custom postfix configuration per target SMTP server

15 (edited by neozimpi@gmail.com 2015-04-08 21:04:31)

Re: SMTP Server for each Domain

My config Example:

[INBOUND]
My-Mailserver           <<<<<<            external mail server
Getmail4                                         online ip
(getmail fetches the mails from the provider and delivers them via dovecot)
This works great.

[OUTBOUND]
My-Mailserver           >>>>>>>         external mail server
domain x                                         online ip
I want to use the providers SMTP-Server.
At the moment the cients use the providers SMTP server in their SMTP settings.
(Thunderbird)
only that i have not 1 domain. I have 4 Domains.


That would mean editing the POSTFIX and LDAP config right.

Thank you very much for your patience.

16

Re: SMTP Server for each Domain

Oops, my mistake. You need sender dependent relayhost instead of per-domain transport in your case:
http://www.postfix.org/postconf.5.html# … yhost_maps

17

Re: SMTP Server for each Domain

ZhangHuangbin wrote:

Oops, my mistake. You need sender dependent relayhost instead of per-domain transport in your case:
http://www.postfix.org/postconf.5.html# … yhost_maps

Nice.
Thank you. Can you give me an example what i need to edit? What i have to look for. Special postfix configs and so on.

This would be helpful.
maybe there is an example config file.  smile

18

Re: SMTP Server for each Domain

in /etc/postfix/main.cf:

sender_dependent_relayhost_maps = hash:/etc/postfix/relayhosts

in /etc/postfix/relayhosts:

example.com [smtp.provider.com]:
domain2.com [smtp.live.co.uk]:

Once you have relayhosts file as you want it run the following command

postmap /etc/postfix/relayhosts && postfix reload

19

Re: SMTP Server for each Domain

7t3chguy wrote:

in /etc/postfix/main.cf:

sender_dependent_relayhost_maps = hash:/etc/postfix/relayhosts

in /etc/postfix/relayhosts:

example.com [smtp.provider.com]:
domain2.com [smtp.live.co.uk]:

Once you have relayhosts file as you want it run the following command

postmap /etc/postfix/relayhosts && postfix reload

thank you very much for your help.
I had not the time to test it.
when i check i will reply.

20

Re: SMTP Server for each Domain

So i had time to check if its working.
Now it looks like this. but it doesn't seem to work.
Internal mailing is still working fine but external is not.
Do i have to tell postfix to send mails via command or does postfix send them immediately?
How can i authenticate myself on the SMTP server to send the mail?
Connection from provider aborted.

/etc/postfix/main.cf

mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
relayhost =
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhosts

/etc/postfix/relayhosts

1und1.de [smtp.1und1.de]:

any suggestions?

21

Re: SMTP Server for each Domain

is there an /etc/postfix/relayhosts.db file?

22

Re: SMTP Server for each Domain

Also, does the 1und1 server accept emails without authentication? (is it an open relay)

23

Re: SMTP Server for each Domain

is there an /etc/postfix/relayhosts.db file?

There is no relayhosts.db file.

Also, does the 1und1 server accept emails without authentication? (is it an open relay)

No open relay, it wants authentication.

24

Re: SMTP Server for each Domain

1) you didn't run the command I mentioned.

neozimpi@gmail.com wrote:

postmap /etc/postfix/relayhosts && postfix reload

2) you didn't specify that, so the SMTP relay should get what credentials? The same ones for each request?

25

Re: SMTP Server for each Domain

To get it working with authentication is a little too complicated to explain over forum. Contact me at
postmaster _at_ webdevguru.co.uk