1

Topic: Send emails to the same domain as the server but not locally

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer? Downloadable
- Linux/BSD distribution name and version: Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Nop
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,


I have a problem with iRedMail / Postfix, I also have the impression that my "mydestination" variable is not taken into account.

Let me explain :
I own the domain "xyz".com

My server is only used to send commercial emails, so we have another mail server for sending and receiving message, this mail server is intended, only for the use of our CRM

Sometimes a copy needs to be sent to the commercial who sent the mail, in other words, I would like commercial@xyz.com receive a copy

Except that as the commercial@xyz.com is not found locally, the e-mail is not sent and it never receives its copy.

I can put in main.cf
mydestination =

Iredmail / Postfix continues to want to deliver the message locally without going out to my domain's DNS zone.

As a result, I don't really understand what's going on.


# Accepted local emails
mydestination =
#mydestination = $myhostname, localhost, localhost.localdomain

Test from Rouncube or other :

postfix/submission/smtpd[6572]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 550 5.1.1 <mto@xyz.com>: Recipient address rejected: User unknown; from=<contact@xyz.com> to=<mto@xyz.com> proto=ESMTP helo=<localhost>
Oct 22 11:58:16 sendmails roundcube: <sl9h97uu> PHP Error: Invalid response code received from server (POST /mail/?_task=mail&_unlock=loading1603360696357&_framed=1&_lang=en&_action=send)
Oct 22 11:58:16 sendmails roundcube: <sl9h97uu> SMTP Error: Failed to add recipient 'mto@xyz.com'. 5.1.1 <mto@xyz.com>: Recipient address rejected: User unknown (Code: 550) in /opt/www/roundcubemail-1.4.7/program/lib/Roundcube/rcube.php on line 1702 (POST /mail/?_task=mail&_unlock=loading1603360696357&_framed=1&_lang=en&_action=send)
Oct 22 11:58:16 sendmails postfix/submission/smtpd[6572]: disconnect from localhost[127.0.0.1] ehlo=2 starttls=1 auth=1 mail=1 rcpt=0/1 rset=1 quit=1 commands=7/8

Any idea ?
Thank you for your help !

----

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

2 (edited by MW 2020-10-24 02:01:08)

Re: Send emails to the same domain as the server but not locally

I believe something like this would help, assuming you're using the MySQL backend:

INSERT INTO `forwardings` (`address`, `forwarding`, `domain`, `dest_domain`, `is_maillist`, `is_list`, `is_forwarding`, `is_alias`, `active`) VALUES ( '@my-domain.com', '@my-domain.com', 'my-domain.com', '', 0, 0, 1, 0, 1);

3

Re: Send emails to the same domain as the server but not locally

If mail domain "xyz.com" is hosted locally on iRedMail server, it gets the domain name from SQL directly, no DNS query required. So if user commercial@xyz.com is not present locally, it can not send out.

4

Re: Send emails to the same domain as the server but not locally

Hi Michael

This sounds like a similar use case to what I had at one of my clients, where the same domain name was used on multiple servers across the country, what I did was create a transport map file that directs local mailboxes to the dovecot service for delivery to the mailbox, and all others for that domain go via a relayhost that will deliver to the domains MX record.

See my original post here:
https://forum.iredmail.org/post72065.html#p72065

Granted as I mentioned in that post, there's probably a better way to do it, but that's the best I could come up with for my skills in iRedMail

Definitely test in a virtual environment before you roll it out on a production server