Setting appropriate email attachment limits is more nuanced than simply picking an arbitrary number. While many admins default to 10-20MB with the standard "email isn't for file transfers" disclaimer, modern Exchange environments demand a more systematic approach.
When determining attachment size limits for an Exchange 2007 environment with 50 mailboxes (mixed 2007/2003 clients), consider these technical aspects:
- Storage Infrastructure: Calculate available storage against expected email volume
- Network Bandwidth: Evaluate internal and external bandwidth constraints
- Recipient Limitations: Consider compatibility with external recipients' systems
- Transport Pipeline: Assess message processing capabilities
Here's a PowerShell script to analyze mailbox usage patterns and suggest limits:
# Exchange 2007 Attachment Size Analyzer
$mailboxes = Get-Mailbox -ResultSize Unlimited
$attachmentStats = @()
foreach ($mbx in $mailboxes) {
$stats = Get-MailboxStatistics -Identity $mbx.Identity | Select DisplayName,TotalItemSize
$largeItems = Get-MessageTrackingLog -ResultSize Unlimited -Start (Get-Date).AddDays(-30)
-EventId "RECEIVE" -Server $env:COMPUTERNAME |
Where { $_.Sender -eq $mbx.PrimarySmtpAddress -and $_.TotalBytes -gt 10MB }
$attachmentStats += [PSCustomObject]@{
Mailbox = $mbx.DisplayName
AvgAttachmentSize = ($largeItems | Measure-Object -Property TotalBytes -Average).Average
MaxAttachmentSize = ($largeItems | Measure-Object -Property TotalBytes -Maximum).Maximum
LargeItemCount = $largeItems.Count
}
}
$attachmentStats | Export-Csv -Path "C:\Reports\AttachmentAnalysis.csv" -NoTypeInformation
When configuring limits in Exchange 2007:
# Set organization-wide limits
Set-TransportConfig -MaxSendSize 25MB -MaxReceiveSize 25MB
# Optional per-mailbox overrides
Get-Mailbox | Set-Mailbox -MaxSendSize 25MB -MaxReceiveSize 25MB
# Configure connectors if needed
Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize 25MB
Get-SendConnector | Set-SendConnector -MaxMessageSize 25MB
For environments frequently needing larger file transfers:
- Implement secure FTP with automated email notifications
- Configure SharePoint document libraries with email alerts
- Deploy a dedicated file sharing solution with Outlook integration
Create a scheduled task to monitor NDRs caused by size limits:
# NDR Monitoring Script
$ndrReports = Get-MessageTrackingLog -ResultSize Unlimited -Start (Get-Date).AddDays(-7)
-EventId "FAIL" | Where { $_.MessageSubject -match "exceeded maximum" }
if ($ndrReports.Count -gt 0) {
Send-MailMessage -To "admin@domain.com" -Subject "NDR Alert"
-Body "There were $($ndrReports.Count) NDRs related to size limits this week"
-SmtpServer "mail.domain.com"
}
Setting attachment size limits often feels like throwing darts blindfolded. Many admins default to arbitrary values like 10-20MB with the standard "email isn't for file transfers" justification. But when implementing a new Exchange Server (especially in mixed 2007/2013 environments), we need a more systematic approach.
For an environment with 50 mailboxes, consider these technical parameters:
// Pseudocode for calculating attachment limits
function calculateAttachmentLimit() {
const storageCapacity = getExchangeStorage(); // in GB
const dailyMessages = getAverageMessageCount();
const avgMessageSize = getMessageSizeMetrics();
const bandwidth = getNetworkBandwidth();
// Calculate base limit considering 20% of average daily traffic
const baseLimit = (storageCapacity * 1024) / (dailyMessages * 0.2);
// Adjust for network constraints
const networkAdjustedLimit = Math.min(baseLimit, bandwidth / 2);
return formatSize(networkAdjustedLimit);
}
For Exchange 2007/2013 hybrid environments, use PowerShell to set consistent limits:
# Set global transport limits
Set-TransportConfig -MaxSendSize 25MB -MaxReceiveSize 25MB
# Set mailbox server limits
Get-MailboxServer | Set-MailboxServer -MaxSendSize 25MB -MaxReceiveSize 25MB
# Set individual mailbox limits (if needed)
Get-Mailbox -ResultSize Unlimited | Set-Mailbox -MaxSendSize 25MB -MaxReceiveSize 25MB
Implement monitoring to validate your limits:
# PowerShell script to monitor attachment sizes
$report = Get-MessageTrackingLog -Start (Get-Date).AddDays(-30) -EventId RECEIVE |
Where-Object {$_.TotalBytes -gt 10MB} |
Select-Object Timestamp,Sender,Recipients,MessageSubject,TotalBytes |
Sort-Object TotalBytes -Descending
$report | Export-Csv -Path "LargeAttachmentsReport.csv" -NoTypeInformation
- Align limits with your backup window and storage retention policies
- Consider implementing message size limits per recipient count
- For frequent large file transfers, integrate with SharePoint or OneDrive
For more advanced environments, consider dynamic limits based on:
// C# example for dynamic limit calculation
public class AttachmentLimitCalculator {
public double CalculateDynamicLimit(DateTime time, string sender) {
var baseLimit = 25.0; // MB
var adjustment = 0.0;
// Reduce limits during business hours
if (time.Hour >= 8 && time.Hour <= 18) {
adjustment -= 5.0;
}
// Increase limits for executives
if (IsExecutiveSender(sender)) {
adjustment += 10.0;
}
return Math.Max(10.0, baseLimit + adjustment);
}
}