Re-route mail stuck in queue Exchange 2013 - exchange-server

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!

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.

Which SMTP sever to send Java Mail to when the server is cloud-based?

Java 8 here, although this really is more of a generic Exchange/SMTP question I suppose.
I purchased a domain name and Office 365 support from GoDaddy, and as a result, have several email addresses through them. Let's say one of these is support#myapp.example.com.
I am writing a Java 8 app that will allow users to send emails to this support address (through the app). I will likely use the excellent Simple Java Mail library, which wraps the Java Mail API. And so somewhere in my app there will be some code that looks something like:
Email email = EmailBuilder.startingBlank()
.to("MyApp Help Desk", "support#myapp.example.com")
.withSubject("Support Ticket #12345")
.withPlainText("Something went wrong inside the MyApp!")
.buildEmail();
Mailer mailer = MailerBuilder
.withSMTPServer("smtp.host.com", 587, "user#host.com", "password")
.withTransportStrategy(TransportStrategy.SMTP_TLS)
.withProperty("mail.smtp.sendpartial", true)
.buildMailer();
mailer.sendMail(email);
Pretty straight-forward stuff, right? Except I'm confused about one simple thing: which SMTP server am I using here? Would I use the Microsoft Exchange server that my GoDaddy account provides me, or would I choose something else?
That depends a little bit on what you want to do.
If you just want to make one attempt to send the mail, you connect to the mail server that accepts mail for support#myapp.example.com. It sounds like this is an office365 server owned by Microsoft that accepts mail for myapp.example.com. There should be public DNS records for that domain. I haven't used the Simple Java Mail library, but from your pseudocode, I assume it does the DNS lookups for you.
It sometimes happens that an application encounters errors when trying to send an email. For example, somebody could restart your app server in the middle of the smtp conversation, or reboot your router, or something else. It's pretty common to use a Mail Transfer Agent (MTA) such as Exchange to help make this process more robust. If the MTA fails on the first delivery attempt, it will retry delivery for some configurable period of time. In your case, you could send the email to your Exchange server, and it would route the email to myapp.example.com.
(In this case, Exchange is sort of acting as a Mail Submission Agent (MSA), but that's kind of a nitpick.)
Hope this helps.

Exchange 2010 is sending emails from accounts that do not exist?

All of a sudden, our exchange server has started sending out emails to .com.br addresses from accounts that do not exist in our organization. For example:
sadfjkh32#myorganization.com
sasdfsdkh4352#myorganization.com
sadhdf#myorganization.com
Please help.
You should review your recieve connector configuration to make sure you are not allowing someone to relay mail over your server.
Aditionally use the message tracking in esm and look for those emails.
Try to find the source IP address of those emails, meaning where they are generated.
Are they generating from an application server on your network. Maybe a scanner device, a pc...
As soon as you find the ip address you will have a better idea what is going on
Liran Zamir

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

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