1

Topic: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

==== Provide required information ====
- iRedMail version and backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Any related log? Log is helpful for troubleshooting.
====
Hi all ,

On my iredadmin I had created a new domain pa.gov.sg(this is client's domain) , and a mail account name test@pa.gov.sg for the client's request . The mail was working ok , my problem is when the client use the account test@pa.gov.sg to send mail to other mail like sales@pa.gov.sg or contact@pa.gov.sg(these two mail are on the client's mail server , they are not created on my server) the error apear : smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

I understand that the iredmail didnt find sales@pa.gov.sg or contact@pa.gov.sg on my server so it couldnt send mail .
So I configured the main.cf on these lines :
     smtpd_reject_unlisted_recipient = no
     smtpd_recipient_restrictions ---> I removed the reject_unlisted_recipents 
And the mails were sent with no error , but when the client check two mails sales@pa.gov.sg and contact@pa.gov.sg , they didnt receive any mail . They cant receive mail even the mail is sent successfully
Here the log :

connect from mail.xxx.com[127.0.0.1]
 E9D6B259A5: client=mail.xxx.com[127.0.0.1]
 E9D6B259A5: message-id=<6a2abc6fde943bfc4ec4ca11a16fc8a7@pa.gov.sg>
 E9D6B259A5: from=<DO_NOT_REPLY@pa.gov.sg>, size=1505, nrcpt=1 (queue active)
 disconnect from mail.xxx.com[127.0.0.1]
 (11054-01) Passed CLEAN, LOCAL [203.142.24.32] [203.142.24.32] <DO_NOT_REPLY@pa.gov.sg> -> <sales@pa.gov.sg>, Message-ID: <6a2abc6fde943bfc4ec4ca11a16fc8a7@pa.gov.sg>, mail_id: GfLu344Mcnzg, Hits: -10, size: 1032, queued_as: E9D6B259A5, 1931 ms
 E547A22413: to=<sales@pa.gov.sg>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.7, delays=0.61/0.01/0.01/2, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as E9D6B259A5)
 E547A22413: removed
 E9D6B259A5: to=<sales@pa.gov.sg>, relay=dovecot, delay=0.15, delays=0.01/0.03/0/0.11, dsn=5.1.1, status=bounced (user unknown)
 1A01C259A6: message-id=<20120726072721.1A01C259A6@mail.xxx.com>
 1A01C259A6: from=<>, size=3471, nrcpt=1 (queue active)
 E9D6B259A5: sender non-delivery notification: 1A01C259A6
 E9D6B259A5: removed
 1A01C259A6: to=<DO_NOT_REPLY@pa.gov.sg>, relay=pa.gov.sg[203.142.24.32]:25, delay=0.89, delays=0.01/0.08/0.68/0.12, dsn=2.0.0, status=sent (250 OK id=1SuITf-0005qh-SW)
 1A01C259A6: removed

Here is my config for postfix

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailbox_command = /usr/libexec/dovecot/deliver
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_backoff_time = 4000s
maximal_queue_lifetime = 1d
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = futureworkz.com
myhostname = mail.futureworkz.com.sg
mynetworks = 127.0.0.0/8
mynetworks_style = subnet
myorigin = mail.futureworkz.com.sg
newaliases_path = /usr/bin/newaliases.postfix
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_directory = /var/spool/postfix
queue_run_delay = 300s
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
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
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
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_non_fqdn_sender, reject_non_fqdn_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 = no
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/pki/tls/certs/iRedMail_CA.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/iRedMail_CA.pem
smtpd_tls_key_file = /etc/pki/tls/private/iRedMail.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
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
unknown_local_recipient_reject_code = 550
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:502
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 = 500
virtual_transport = dovecot
virtual_uid_maps = static:500

Sorry for my bad english
Please help me solve this problems . Thanks you very much

----

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

2

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

Mail was not sent at all according to this log message:

E9D6B259A5: to=<sales@pa.gov.sg>, relay=dovecot, delay=0.15, delays=0.01/0.03/0/0.11, dsn=5.1.1, status=bounced (user unknown)

You host domain pa.gov.sg on localhost, so all emails sent to @pa.gov.sg will be delivered to localhost. If recipient doesn't exist on localhost, Postfix will bounce this email. You modification (smtpd_reject_unlisted_recipient = no, smtpd_recipient_restrictions without reject_unlisted_recipents) works while sending out email, but not work when LDA delivers email.

3

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

Thanks for your quick reply ,
Do you have any solution for my case ? How do I  make LDA delivers email external with two email sales@pa.gov.sg and contact@pa.gov.sg

4

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

How about relay emails to your client's mail server?

Steps:

- Add users sales@ and contact@ with iRedAdmin on your server.
- Update transport of these two users (sales@, contact@) to "smtp:[your_clients_server]:25".

That's all.

To update transport of user, if you have iRedAdmin-Pro installed, please go to user profile page, tab "Relay".
if you don't have iRedAdmin-Pro installed, please update it with MySQL command line tool directly:

$ mysql -uroot -p
mysql> USE vmail;
mysql> UPDATE mailbox SET transport='smtp:[your_clients_server]:25' WHERE username='sales@pa.gov.sg';
mysql> UPDATE mailbox SET transport='smtp:[your_clients_server]:25' WHERE username='contact@pa.gov.sg';

Let me know whether it works for you or not.

5 (edited by eric 2012-07-27 12:47:35)

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

Thank you very much it works like a charm .
If I want to use this for entire users on domain pa.gov.sg , I have to config it on the domain column  like this right ?
UPDATE domian SET transport='smtp:[your_clients_server]:25 WHERE domain='pa.gov.sg';

And if I want to use gmail to be the relay host for this domain , is it posible ? because I have an error when doing this Must issue a STARTTLS command ...

6

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

eric wrote:

If I want to use this for entire users on domain pa.gov.sg , I have to config it on the domain column  like this right ?
UPDATE domian SET transport='smtp:[your_clients_server]:25 WHERE domain='pa.gov.sg';

You're right. And don't forget to remove per-user transport, because per-user transport setting has high priority.

mysql> UPDATE mailbox SET transport='' WHERE username='sales@pa.gov.sg';
mysql> UPDATE mailbox SET transport='' WHERE username='contact@pa.gov.sg';
eric wrote:

And if I want to use gmail to be the relay host for this domain , is it posible ? because I have an error when doing this Must issue a STARTTLS command ...

Try transport smtp:[smtp.gmail.com]:587

7

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

Thanks you , I have tried smtp:[smtp.gmail.com]:587 but it required a certificate , how could I put a certificate on iredmail to use for this case ?

8

Re: smtp_error5.1.1 : Recipient address rejected: User unknown in virtual

Try Postfix parameter:

smtp_tls_CAfile = /etc/pki/tls/certs/iRedMail_CA.pem