1

Topic: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

Hello

I see solution for LDAP
http://www.iredmail.org/forum/topic334- … ution.html

How to do on a MYSQL installation?

Is it simple done in the mysql admin under the relay setttings?

In the Domain properties, what is the correct syntax for the Relay/Transport Setting on a MYSQL install?

I have tried:
mtaTransport: smtp:[IP-Address-Destination]:25
domain.name smtp:[IP Addreess-Destination]
domain.name relay:[IP-Addreess-Destination]
smtp:[10.1.1.241]:25

----

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

2

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

That's easy for MySQL backend.

- For per-domain relay setting, please update column "domain.transport".
- For per-user relay setting, please update column "mailbox.transport".

Its value should be something like this: smtp:[10.1.1.241]:25. Please refer to Postfix official doc for more examples: http://www.postfix.org/transport.5.html

3 (edited by darth_wells 2012-01-10 11:47:24)

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

- For per-domain relay setting, please update column "domain.transport".

Where is this set?

- For per-user relay setting, please update column "mailbox.transport".

Where is this set?

If this set in the admin panel under the relay tab, the relay/transport setting, or do I need to go into phpmysqladmin?

Note:   I tried this and when I send email from other domains on the server, I get a unknown relay_recipient error.

4

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

Oh, sorry, you didn't mention you have iRedAdmin-Pro, and i forgot to promote iRedAdmin-Pro with screenshots of relay settings.

With iRedAdmin-Pro-MySQL, you can go to domain/user profile page , choose "Relay" tab and update relay setting. No need to go to phpMyAdmin. Screenshots of domain/user relay setting attached below.

About "unknow relay recipient" error, it means Postfix cannot find this user in relay recipient list. Please paste output of command "postconf -n" to help troubleshoot.

Per-domain relay setting:
http://screenshots.iredmail.googlecode.com/hg/iredadmin/domain_profile_relay.png

Per-user relay setting:
http://screenshots.iredmail.googlecode.com/hg/iredadmin/user_profile_relay.png

5

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

nm2:~# postconf -n
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
maximal_backoff_time = 4000s
maximal_queue_lifetime = 1d
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = abgnetwork.net
myhostname = nm2.abgnetwork.net
mynetworks = 127.0.0.0/8, 10.1.1.0/24
mynetworks_style = subnet
myorigin = nm2.abgnetwork.net
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
queue_run_delay = 300s
readme_directory = no
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf
recipient_delimiter = +
relay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf
relayhost =
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_enforce_tls = no
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,permit_sasl_authenticated, check_helo_access pcre:/etc/postfix/helo_access.pcre
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = ./dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_tls_CAfile = /etc/ssl/certs/gd_bundle.crt
smtpd_tls_cert_file = /etc/ssl/certs/nm2.abgnetwork.net.crt
smtpd_tls_key_file = /etc/ssl/private/nm2.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:1001
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_minimum_uid = 1001
virtual_transport = dovecot
virtual_uid_maps = static:1001

6

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

From the roundcube login whey I try to send a email to the user.

SMTP Error (550): Failed to add recipient "test@yoda.com" (5.1.1 <test@yoda.com>: Recipient address rejected: User unknown in virtual mailbox table).

I don't have any users setup, if I do setup a user, it will go locally.

7

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

"Recipient address rejected: User unknown in virtual mailbox table" means you don't have user "test@yoda.com" hosted on iRedMaiil server. If you don't add this user, you will continue getting this error message.

darth_wells wrote:

I don't have any users setup, if I do setup a user, it will go locally.

I don't understand, is anything wrong if it goes locally?

8

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

Background:   Our company is a small isp.

Our iRedmail server hosts many pop3/imap domain accounts.    Our company would also like to provide our clients that run Microsoft exchange the ability to get their email filtered for spam & viruses and sent to them and for them also to use our server to send their outbound email.

Our clients on setup on pop3/imap iRedmail server need the ability to communicate with the domains that are relayed.

9

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

OK, do you get per-domain/user relay setting solved?

10

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

Update:

I created a user on the system, and under the relay tab I put the relay information (which is the same as the domain relay) and now it allows me to send the email from another domain on the iRedmail server and it delivers it correctly to the exchange server.

Do I need to re-create every user to match the exchange server with the Relay/Transport settings?

11

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

darth_wells wrote:

(which is the same as the domain relay)

Do you mean you configured both per-user and per-domain relay with same setting?
If so, you can simply leave per-user relay empty, Postfix will use per-domain relay setting if there's no per-user relay setting configured.

darth_wells wrote:

Do I need to re-create every user to match the exchange server with the Relay/Transport settings?

If you want to relay ALL mails under this domain to Exchange server, then only per-domain relay setting is required, please leave all per-user relay setting empty.

12

Re: [SOLVED] How to relay your mails per-domain or per-user (MYSQL)

Re-tested and you were right, I don't need to put in for every user, the domain feature is working.