Monday, September 12, 2016

Exchange Connectors to send and receive 30MB emails

Exchange server 2010/2013/2016 by default has a limit of 10MB to send and receive emails. Now how to expand those limits to today's requirements?.

1. Open you Windows powershell console in your exchange server

Open a Powershell for exchange:

 

 

2. Run this commands for the Receiving Connectors

#Get the actual MaxMessageSize
Get-ReceiveConnector | Select Identity,Bindings,MaxMessageSize
#Modify them all at once
Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize 30MB

By doing this you will have expanded all receive connectors to receive up to 30MB emails, you can verify that using the 1st command again:

#Get the actual MaxMessageSize
Get-ReceiveConnector | Select Identity,Bindings,MaxMessageSize
In this case, the client has configured 100MB instead of 30MB.
SideNote: It's important to be aware of a 100MB to send and receive files will literally EAT all your free space in the database and hard drive in your server, beside of all mailboxes will grow exponentially and will make it difficult and really expensive to migrate. Please use other technologies to move big size files, like Onedrive or Onenote, and just share a "Read-Only" link to your client by email.

 

3. Run this commands for the Sending Connectors

#Get the actual MaxMessageSize
Get-SendConnector | Select Identity,Bindings,MaxMessageSize
#Modify them all at once
Get-SendConnector | Set-SendConnector -MaxMessageSize 30MB

 

By doing this, you will have modified the send connectors to send emails up to 30MB.

 

4. Set the transport configuration to send up to 30MB

This can be done in one step:
#Get the actual MaxMessageSize in the transportconfiguration
Get-TransportConfig | select MaxSendSize,MaxReceiveSize
#Modify it
Set-TransportConfig -MaxSendSize 30MB -MaxReceiveSize 30MB
#verify it
Get-TransportConfig | select MaxSendSize,MaxReceiveSize

 

And that's it!, thank you for reading

Please consider to donate and thank you very much for reading this.

Saturday, July 16, 2016

How to Suspend a Queue to manage the spam in Exchange server 2013

Managing Spams in exchange server

Exchange server 2013 is receiving an unusual amount of spam in the client's mailboxes, what can be done?

1. Stop the Queue during the night: "mail\Submission"

Open a Powershell for exchange:

 

The one in the right and run

 

Suspend-Queue -Identity mail\Submission -confirm:$false
This will stop the email submission queue without asking confirmation (-confirm:$false)

 

2. Detect the subjects more commonly used by spammers

 

In my case were "FW:","scanned","attached","RE:"

 

So I suspend all those messages by running:
Get-queue  -Identity mail\submission | Get-Message |  Where-Object{ $_.subject -match "RE:" -or $_.subject -Match "FW:" -or $_.subject -match "scanned" -or $_.subject -match "attached" } | Suspend-Message 

 

By doing this, you will have all the suspicious messages will have the "suspend" state.

 

3. Create Rule and populate it with a list of Domains to be blocked

 

Create a manual rule in ECP

Mail flow/rules/+/Create New Rule
More Options
In the name Field : "Blocked Domains" and
add a condition with a dummy domain: domain.com then click "+" and then "ok"
Finally: save

4. Populate the rule

Now by running:
$exported=@()
Get-queue  -Identity mail\submission | Get-Message |  Where-Object{ $_.subject -match "RE:" -or $_.subject -Match "FW:" -or $_.subject -match "scanned" -or $_.subject -match "attached" }   | foreach{ $temp = New-Object PSObject -property @{ FromAddress = ($_.FromAddress -split "@")[1]};  $exported+=$temp} | Select FromAddress

$domains=Get-TransportRule "Blocked Domains" | select -ExpandProperty SenderDomainIs
foreach ($item in $exported.fromaddress)
{
 $domains += $item.domain
 $domains2add = $domains | select -Unique
}
Set-TransportRule "Blocked Domains" -SenderDomainIs $domains2add
You will get the rule populated.

5. Remove the messages and Resume the queue

get-queue -identity mail\submission | Get-Message | Where-Object{ $_.status -eq "Suspended"} | Remove-Message -confirm:$false
Resume-Queue -Identity mail\Submission

MSCE José Ortega

Please consider to donate and thank you very much for reading this.