You migrated a batch of mailboxes to a new mailbox database in Exchange Server 2016.…
Mail.que file large in size Exchange Server
The Exchange mail.que file is getting large in size. You get an alert that your free space is getting low on disk space. After searching what is taking a lot of space, you find out that it’s the mail.que file. In this article, you will learn how to fix Exchange Server mail.que file large in size.
Table of contents
Find the mail.que file in Exchange Server
How to find the mail.que database? On the Exchange Server, start File Explorer and find the mail.que in the default path.
%ExchangeInstallPath%TransportRoles\data\Queue
I recommend moving the queue folder, which contains the mail.que, to a different drive than the default location. If you want to keep the queue folder on the default path, proceed further.
Check queues in Exchange Server
Get the queues on the Exchange Server. Let’s make use of the Get-Queue cmdlet. Run Exchange Management Shell as administrator. Run one of the following commands to check the queues.
[PS] C:\>Get-Queue
Identity DeliveryType Status MessageCount Velocity RiskLevel OutboundIPPool NextHopDomain
-------- ------------ ------ ------------ -------- --------- -------------- -------------
EX01\8 SmtpDeliveryToMailbox Ready 3 0 Normal 0 db1
EX01\11 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db3
EX01\15 SmartHostConnectorDelivery Ready 2 0 Normal 0 mx1.spambull.com
EX01\19 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db5
EX01\Submission Undefined Ready 0 0 Normal 0 Submission
EX01\Shadow\3 ShadowRedundancy Ready 3 0 Normal 0 ex02.alitajran.local
[PS] C:\>Get-Queue | Select-Object Identity, MessageCount
Identity MessageCount
-------- ------------
EX01\8 3
EX01\11 0
EX01\15 2
EX01\19 0
EX01\Submission 0
EX01\Shadow\3 3
In our example, we have message counts. It means that there are messages in the queue. Proceed further to pause and stop the service.
Pause and stop Microsoft Exchange Transport service
Don’t immediately stop the Microsoft Exchange Transport service. It will not deliver the messages in the queue. You need to pause the service.
[PS] C:\>Suspend-Service MSExchangeTransport
Make sure that all the message count is zero (0). It means that the messages did deliver safely. Check the queue.
[PS] C:\>Get-Queue
Identity DeliveryType Status MessageCount Velocity RiskLevel OutboundIPPool NextHopDomain
-------- ------------ ------ ------------ -------- --------- -------------- -------------
EX01\4 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db9
EX01\8 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db12
EX01\9 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db13
EX01\15 SmartHostConnectorDelivery Ready 0 0 Normal 0 mx1.spambull.com
EX01\20 SmtpDeliveryToMailbox Ready 0 0 Normal 0 db6
EX01\22 SmartHostConnectorDelivery Ready 0 0 Normal 0 mx2.spambull.com
EX01\Submission Undefined Ready 0 0 Normal 0 Submission
EX01\Shadow\3 ShadowRedundancy Ready 0 0 Normal 0 ex02.alitajran.local
After the message count is 0, you can stop the service.
[PS] C:\>Stop-Service MSExchangeTransport
After you stop the service, you can move, rename or delete the mail.que file.
Move/rename/remove mail.que file
You have options with what you want to do with the mail.que file:
- Move the mail.que file in the queue folder to a different disk with enough space.
- Rename the mail.que file to mail.que.old if you have enough space on the same disk.
- Remove the mail.que file if you immediately want to remove the file or don’t have enough disk size available.
In our example, we did remove the mail.que file.
Start Microsoft Exchange Transport service
Now that you did one of the above steps, you can start the Microsoft Exchange Transport Service.
[PS] C:\>Start-Service MSExchangeTransport
After you start the service, let’s check the queue folder.
Check mail.que file and status queue
The queue folder should generate a new mail.que file.
The mail.que file is not large in size anymore. It will be small in size.
Run the Get-Queue command to check the messages in the queue. Messages will start to deliver if there are any in the queue. You can delete the queue folder backup that you made earlier.
What if the mail.que file keeps filling up the disk space? Read the article mail.que file growing in Exchange Server.
Conclusion
In this article, you learned how to fix mail.que file large in size on the Exchange Server. It’s essential to monitor the queue database. It should not grow too big. Remember to pause the service and then stop the service. Move, rename, or remove the mail.que database file. Start the service and check that the system did generate a new mail.que file.
Did you enjoy this article? You may also like Repair failed content index in Exchange. Don’t forget to follow us and share this article.
why the suspended Microsoft Exchange Transport service could still deliever messages in the queue ?
Jim
Thanks Ali! I reference a lot of your articles frequently! Much appreciated!
Fantastic post. Clearly written and easy to follow. 5 out of 5 🙂
Really useful post, thank you – ours was up to 200GB, and causing errors.
Unfortunately, it’s not a fix, but a temporary decision you will come back to after a while.
In my case a mail queue file grows up to 49 Gb and I can’t stand doing this procedure over and over again.
Why a Q-file grows fast and then stop growing is a mystery for me.
Check the Safety Net in Exchange Server.
Safety Net is a queue that’s associated with the Transport service on a Mailbox server. This queue stores copies of messages that were successfully processed by the server.
You can specify how long Safety Net stores copies of the successfully processed messages before they expire and are automatically deleted. The default is 2 days.
Perhaps the value is set higher than 2 days.
Read more in the article: Mail.que file growing in Exchange Server.
Many thanks! Worked great.
Good Post, Great Help !!