Mail Routing for Exchange Server DAG within two sites - exchange-server

I've two Exchange Server 2019 configured with DAG. Exchange Servers are located at different sites. I've databases active on both servers like , DB01 is active on EX1 and DB02 is active on EX2. Now what's happening if EX2 receives an email for user Joe which is sitting on DB02 should get email instead EX2 route email to EX1 then EX1 route back it to EX2 then finally Joe receives the email.
Regards,
hi,
I've two Exchange Server 2019 configured with DAG. Exchange Servers are located at different sites. I've databases active on both servers like , DB01 is active on EX1 and DB02 is active on EX2. Now what's happening if EX2 receives an email for user Joe which is sitting on DB02 should get email instead EX2 route email to EX1 then EX1 route back it to EX2 then finally Joe receives the email.

I think your concern is that the Front End Transport and Transport service are picking random servers to handle the message, unlike Mailbox Transport service which always happens where the mailbox is (fixed).
Because apparently, when a message lands in your environment, it would land to either of the two servers no matter where the user is -> then is passed to either of the two servers to do some transport tasks such as categorizing (AGENT in message tracking).
Refer to the mail flow picture in https://learn.microsoft.com/en-us/exchange/mail-flow/mail-flow?view=exchserver-2019
This is annoying because if we look at this, we will think that, oh this is not efficient!
However, this is by design because both Front End Transport and Transport service work based on routing tables.
Like the Transport service, the Front End Transport service loads routing tables based on information from Active Directory, and uses delivery groups to determine how to route messages.
https://learn.microsoft.com/en-us/exchange/mail-routing-exchange-2013-help
Exchange server reads from Active Directory for:
1. Active Directory sites
2. IP site links
3. All Exchange servers
And then routing tables are updated with the collection of above information retrieved.
No rule set there for this process makes us feel the message tracking looks not efficient, however, this is also the key why it is quick (we will never have a problem where the mail delays because of processing which is the next hop) and stable (when reading from AD).
In some environment, I've seen customized routing table - this requires some developing work, but to be honest, I did not see necessity there as it makes the mail flow super complicated.
Simple is Beautiful.

Related

Exchange server mail interceptor (connector/delivery agents/mailflow)

My basic requirement is that I need to create "something" that is capable of intercepting emails incoming/outgoing from our mail server. It cannot be an extension to mail clients. Currently we consider only exchange server. In my research I found below resources that seems to be helpful.
Mail flow and the transport
Delivery agents and Delivery Agent connectors
Transport agents
From these transport agents seems to be quite old. Now I can't figure out what's the best from the remaining options(Mail flow and the transport or Delivery agents and Delivery Agent connectors).
Whatever I develop should be able to read email get some statistics (using mail header(s), amount of attachments etc...) and store it into a custom database. Additionally add some custom headers to incoming/outgoing mails.
Can anyone point me to right direction? Should it be some kind of a service that I can install in Exchange server? (admin center->mail flow-> connectors). For example, can I write it in c# and host it like an assembly? or may be a web hook to a hosted service where Exchange will forward emails in real time etc...
I couldn't find any examples/tutorials except this
If its OnPrem Exchange and you don't have or are considering Office365 then Transport Agents would be the right thing to use. They haven't change since 2013 but are still what is used for this type of thing the last SDK was 2010 but its still valid given the lack of change on the backend https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd877026(v=exchg.140)
Delivery Agents are more for when you have an external gateway that you want to send and receive messages from.

Re-route mail stuck in queue Exchange 2013

I was setting up two new Exchange 2013 servers with MBX/CAS roles and added them to the existing send connectors that route mail through a smart host. Apparently the guy who quit before I started never got the networking team to whitelist the IPs for these servers. Now, I've got a small chunk of mail sitting here that won't send because of this. My networking team says that they can't do anything about it until tomorrow night. I'm afraid that some business critical mail may have got caught before I noticed what was going on. My question is, how can I re-route the mail stuck in these queues to go out through the send connectors from the previously implemented Exchange servers?
First of all, you should remove these servers from the send connectors to avoid more messages being stuck. You can either remove them from GUI console or by using cmdlet Set-SendConnector
Check here for more details about Set-SendConnector
Secondly, you should export those messages stuck in queue as .eml files by using Export-Message cmdlet.
Check here for more details about how to use Export-Message
At last, you can put all these .eml files under Pickup or Replay folder on any working transport servers. The transport service will pick up all eml files there and submit them to re-transport.
Check here for more details about Pickup and Replay folder
Closely monitor the queue and ensure all emails are delivered, then you are good!

XMPP Multiple tabs synchronize sent message

I am implementing an Openfire chat client in a web site with Strophe.js. I managed to get multiple sessions and multiple windows reloading page and reconnecting back. Now I have challenge in restoring the chat history.
But the first issue I am stuck at when a user opens two tabs of our site it creates two xmpp sessions with different resource ID's but now say
a#example.com/tab1 sent a message to friend this should be synchronized in tab2
Example if you send chat message from gtalk user sent message will be updated and showin in gmail chat window.
Any one has any idea.
Thanks you very much for the time and help.
The routing logic for multiple resources is up to the server implementation. The GTalk server routes messages sent to bare Jids to all connected resources. Many other servers (also Openfire) send messages to bare Jids to the most available resource, which is the one with the highest priority.
If each of your tabs has its own resource then I suggest to send the messages to each resource (full jid) manual. You get all connected resources of your subscribed contacts with the presence.
Yes, there is. Have a look at XEP-0280: Message Carbons ( http://xmpp.org/extensions/xep-0280.html )
Both your client as well as your server have to support it in order to fully work.
Source : https://superuser.com/questions/866785/is-there-a-way-to-sync-xmpp-messages-across-different-devices-with-standard-xmp

duplicated JabberId resource on multiple devices

XMPP sends messages only to highest priority resources of a given JID. See 1, 2 and 3
I want to create a client that will check all my current resources (home, work, mobile)
the client will be able to announce itself with one of those existing resources
the hope is that the client will be able to receive messages into multiple devices. This should work.... unless for some reason the service doesn't accept multiple clients with the same resource? is that something specified in the protocol? or something that implementations might choose to allow/forbid?
The full JID is a unique identifier, so you cannot be logged in twice with the same one.
If you want more than one client to receive messages, then this can be accomplished by having both of them (different resources) with the same priority and using a server which supports this type of routing. This is an option under the spec.
XMPP sends messages only to highest priority resources of a given JID.
This depeds on your server configuration or server software. There is also server software wich routes messages to bare jids to all resources.
You get all connected resources f your contacts with the presence. So you could also manual send the message to each resource directly.

Pipe incoming email to a script on Windows IIS SMTP?

I have a web application running on Windows IIS. This app has a database where each item has a unique key (1, 2, 3...), and a list of email addresses (among other things).
I would like users to send email to the server, using an email address that identifies the item, then have the server relay the message to the email addresses for that item. For example, if a user sends email to the following address:
item-75#myserver.example.com
Then the server would receive the email and pipe it to a script. The script would query the database for item 75 to get a list of email addresses, then re-send the email.
I could do this easily on a unix system using sendmail, but I have no idea if a similar setup can be accomplished on a Windows system (or if it would require additional software).
(This sounds like you want to implement a feature like craigslist).
The IIS SMTP service can send email, and also accept email.
Here is what you want to do.
Configure your IIS SMTP service to accept emails for a domain (You can configure this in the properties of the IIS SMTP service, under domains). Say domain name "myserver.example.com"
Then, in your DNS server, configure a MX record that points to "myserver.example.com".
Now, when email gets sent to your IIS SMTP server, it will actually get placed in your mailroot/drop folder (you can also change this folder in the IIS SMTP Service properties).
Now that you are accepting email, the next step is to write a script that will:
1)Parse the emails.
2)Modify them accordingly (do you just want to change the "to" address?).
3)If you want to resend the emails, then you need to modify them accordingly.
You will need to add a single X-Sender header, that is used to identify the email address sending the email, and a X-Receiver header, for each recipient that is going to accept the email. Here is an example email that was modified:
X-Sender: me#mywebsite.com
X-Receiver: recip1#theirdomain.com
X-Receiver: recip2#theirdomain.com
From: "jim bob" <jim#example.com>
To: <item-75#myserver.example.com>
Subject: test
MIME-Version: 1.0
Content-Type: text/plain;
Message-ID: <024f01c9e130$b3eca500$0401a8c0#local>
test
Once you have this modified content, you will want to write it to a file in the mailroot/pickup directory. Be sure to use a unique name.
The IIS SMTP Service will come by, pickup the email, and relay it on, sending the email using the X-Sender as the MAIL FROM address, and sending it to each email address listed in each X-Receiver header.
4)Run this script as a scheduled task. Another option is to build it as a windows service, or to implement something like a filesystemwatcher, where it executes each time an email is created as a file.
5)Another option to all of this is to actually implement a SMTP Event Sink, but I think that is overkill for what you want to do, and can create more headaches, than it solves. I would only go the event sink route if I like pain.
Hopefully I didn't make that about as clear as mud.
Event Sinks aren't difficult at all! In fact, there are about a dozen examples written in VBS (which runs on a Win server using WSH) which accomplish exactly what you wish to do. The OnArrival event sink runs in REAL-TIME using any computer user account you wish w/o any security risk since the message is asynchronous and doesn't report back.
This is actually a terribly easy thing to do - one of the easiest. Once set up, it never breaks either. On one server I've had one running for more than 9 years processing a few thousand incoming messages per day! I've set up about a dozen of these things - if it takes you more than a couple hours, you're doing it very wrong. If it were any easier than this on UNIX, my grandmother could be a UNIX programmer so I wouldn't go bragging that this is easier to do on a UNIX server.
http://msdn.microsoft.com/en-us/library/ms528023.aspx
http://support.microsoft.com/kb/894286
http://msdn.microsoft.com/en-us/library/ms526206.aspx
http://msdn.microsoft.com/en-us/library/ms526620.aspx
You could read in email through POP3 or IMAP using a timed script. I'm also a UNIXer so I'm struggling to comprehend how something like this is so difficult, but there you have it. Here's what I reckon you should do.
Make a script in whatever language you like. As long as it can read from POP3 or IMAP.
Have Windows run the script every 5 minutes
Have the script access the mailbox and action any emails it needs to.
My personal preference would be to install Python, but if you're limited... I don't know. ASPNET isn't bad, but I've never used it for dirty-scripting before.

Resources