Sendmail how to forward specific accounts to another server - email

I have to linux mail servers running sendmail, both handling the same domainX.
server1 is declared as MX.
server2 is intended as a supplement that has more storage
I want server1 to handle all email for domainX as follows:
user1: handled locally by server1
user2: handled locally by server1
user3: relayed to server2 and handled locally by server2
How can I achieve this with sendmail?
I know I can forward all mail for domainX to another SMTP server, but how do I do this for only some userY#domainX, but not all ?

Found a workaround, it works for me, not entirely sure if it handles all possible situations properly.
server1 handles mail for domainX
server1 is declared with MX record in DNS
server2 handles mail for domainX and server2
server1 has user1, user2, user3
server1 has user3
server1 has in virtusertable user3#domainX user3#server2
server2 has in virtusertable #server2 %1
The scheme works as follows:
user1 and user2 are handled locally by server1 according to default configuration.
user3 is a virtualuser, translated to user3#server2, thus no longer processed locally, regardless of the existing local user user3.
server2 accepts mail for it's own hostname (specified explicitely).
All mail for all users #server are translated to local usernames. Mail for user3#server2 is translated to local user user3.
Of course, using prefixes to differentiate local accounts between multiple domains is possible.

Related

Powershell and Exchange - Set SMTP Primary address

I'm in an hybrid environement with Exchange 2016 and Office 365.
I wish to script the process to enable a Remote Mailbox, an change the primary SMTP address of a user.
By example, I have a user who Remote Mailbox has been enabled. He has a SMTP primary address like this: User1#My-Group.com
With the command below, I can change the SMTP primary address just fine:
#Disable Email Address Policy
Set-RemoteMailbox User1 -EmailAddressPolicyEnabled $false
#Change SMTP address
Set-RemoteMailbox User1 -PrimarySmtpAddress "User1#My-good-address.com"
Everything is just fine, when I go to my On Premise Exchange 2016, I can see my user1 addresses like that:
SMTP:User1#My-good-address.com
smtp:User1#My-Group.com
...
But, when I put back Email Address Policy to $True, I have this result on Exchange:
SMTP:User1#My-Group.com
smtp:User1#My-good-address.com
...
That doesn't happen when I do the change manually.
Does anyone know why I have this behavior?
Thanks in advance !
Problem solved...
I was just on the ONLY USER who was missing an attribute, and the wrong email policy was applied.

postfix redirect e-mails from same domain to another mailserver

So my question is, for a company we have an old exchange server (they don't want to upgrade or transfer) that is nearly dying from e-mails. But these are just coming from one Mailbox.
So my plan was, redirect info#example.de to another mailbox like info#outlook.onmicrosoft.com.
The other E-Mails should be routed as expected...
# virtual postfix file
info#example.de info#outlook.onmicrosoft.com
#example.de #example.de
For this I also have a transport File.
example.de smtp:mx.mail.de
My problem now is, the redirect is getting bounced (User unknown in virtual alias table)
2B2DEE7: to=<timo.bergen#example.de>, relay=none, delay=0.08, delays=0.05/0.01/0/0.02, dsn=5.1.1, status=bounced (User unknown in virtual alias table)
Fixed this, just had to append the Domain to "mydestinations".
mydestination = $myhostname, web-p03.hosting.it.local, localhost.hosting.it.local, , localhost , example.de

cPanel email routing... if not found locally try remote

I've got a weird setup with my emails that I need someones brain to look at. I've got it setup like this so that most of my emails are on one server (server1) and then 1 single account is setup on a second server hidden from the rest (server2)
Email Sent to user1#domain.me
MX record for domain.me = mail.domain.me
A record for mail.domain.me = server1 (11.11.11.11)
Email forwarding rule forwards all email sent to user1#domain.me to user#2.domain.me
MX record for 2.domain.me = mail2.domain.me
A record for mail2.domain.me = server2 (22.22.22.22) a cpanel server
Email hits my server now addressed to user1#2.domain.me
Domain forwarding rule forwards all email sent to #2.domain.me to #domain.me
This works great however my mail routing in cpanel is set to local, and therefore when sending emails out on server2 (22.22.22.22) to users#domain.me they're always delivered locally first and foremost
Is there any way around this? so that outgoing mail on this domain obey's DNS records (the mx records) and delivers it firstly to server1 (11.11.11.11) as if it was being sent from any other domain, gmail etc. Perhaps if the account isn't found locally then send on out to the web? Or perhaps there is a way to setup an alias somehow to let the local account receive mail for user1#2.domain.me
Thanks for your time & efforts looking into this
Henry
Check if your remote domains are listed in /etc/remotedomains and /etc/secondarymx. Note that if your second server has a dns server, it will try fetch the dns data locally first.
I have 2 servers using cpanel where each server acts as the other's backup and I don't have the issue you described.

HAProxy - Configuring with prefered server

I am using HAProxy for load balancing my application on RHEL7. I have two servers server1 and server2, of which I want server1 as prefered server. My requirement is: server1 should serve all requests by default; if server1 fails, server2 should be active; when server1 is up, server1 should become active and should process requests. Following is my frontend/backend in haproxy.conf:
frontend frontend_2143
bind *:2143
default_backend backend_2143
backend backend_2143
balance roundrobin
mode tcp
server server1 192.160.0.3:2143 check weight 255
server server2 192.160.0.4:2143 check
With this configuration I am receiving all my request at server1 at begining, and at server2 after server1 is down, but when server1 is up, the requests are still getting received at server2.
Can anyone help here?
Try to use the "backup" directive in your config.
See detailed explanation here: http://blog.haproxy.com/2013/12/23/failover-and-worst-case-management-with-haproxy/
And maybe you should check this too: https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4.2-option%20prefer-last-server

1 DNS 2 IPS, 1 IP for email server and 1 IP for website

Hello fellow Stackoverflow users, I have this issue while setting up an email server and website to this email server in two different machines (I've been using Digitalocean's name servers).
example.com REDIRECTS to 107...*
mail.example.com REDIRECTS to example.com
I don't think I'm able to simply change mail.example.com to another IP because then the e-mails wouldn't be like "fellow#example.com"
Any clue about what I should do since they have a rigid abuse system and they would think I'd be abusing if I carefulessly changed those kind of stuff.
Thank you for your time!
If I understood correctly you have 2 different servers ? Which one is webserver and another one for mail ?
If so you should add 3 different records:
A record to webserver:
domain.com. IN A 1.1.1.1
www IN A 1.1.1.1 (www.domain.com)
A record for mail server:
mail IN A 2.2.2.2 - this will create mail.domain.com pont to 2.2.2.2 ip
And then set MX record for that domain:
domain.com. IN MX 10 mail.domain.com - 10 is priority
--
Website will be working from server ip 1.1.1.1, mail will work from 2.2.2.2