• New-ExchangeExportRequest DateTime Problem for non americans…

    [System.Reflection.Assembly]::LoadWithPartialName("System.Threading")
    [System.Reflection.Assembly]::LoadWithPartialName("System.Globalization")
    [System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::CreateSpecificCulture("en-us")
    
    Add-PSSnapin *exchange*
    
    $start = (get-date).adddays(-3)
    $end = (get-date).adddays(-1)
    
    $filter = "(Received -gt '"+$start+"') -and (Received -lt '"+$end+"')"
    new-Mailboxexportrequest -mailbox MAILBOX -ContentFilter $filter -filepath "\\PATH\to.pst"
    

    This exports the mailbox from only the day before yesterday.

    Sources:
    http://rp-it.blogspot.com/2013/05/new-mailboxexportrequest-fails-when.html
    http://occasionalutility.blogspot.com/2014/03/everyday-powershell-part-17-using-new.html

  • sender based routing with exchange 2013 and hMailserver

    Exchange (2013 and other) support sender based routing only through 3rd party software such as described here or here or here. Too complicated or costly I chose to follow this post by using free hMailserver to achieve this:

    • fresh install
    • no domains setup
    • Settings > Protocols: check only SMTP
    • Settings > Protocols > SMTP > Routes
      #1 Domain: default (this is just for naming purposes)
      Target SMTP host: our.default.mailgateway.xyz
      Connection security: STARTTLS (because why not)
      When sender matches: local
      When recipient matches: remote
      (those two settings should have no effect what so ever)

      #2 Domain: newgateway
      Target SMTP host: our.new.mailgateway.xyz
      settings as above
    • Rules:
      #1 Name: new-gatway
      Criteria: From contains newdomain.xyz
      Action: Send using route [newgateway]
      Action: Stop rule processing

      #2 Name: default
      Criteria: Message size > 0
      Action: Send using route [default]
      keep this rule at the end of the list, it affects every mail that has not been routed by a previous rule.
    • IP Ranges:
      Delete existing, create one new:
      Name: local
      priority: 5
      Lower and Upper IP: the local IP address of the server
      (our machine is behind NAT, this is important since we basically turn this hMailserver into an open relay)
      Allow connections: SMTP (nothing else)
      Allow deliveries from: ALL
      Require SMTP authentication from: NONE
    • TCP/IP ports:
      delete all except SMTP, change to custom port (e.g. 1125, 26 or such)

    then change your probably only exchange send connector. I could not change the port via ECP so I used PowerShell:

    Get-SendConnector
    Set-SendConnector SMTP-Connector -SmartHosts “your local server IP” -Port ##your custom port see above##

    This setup works for us and should work for small sized installations.

  • Exchange distribution groups with external contacts

    External emails sending to exchange distribution groups which include contacts with external email addresses tend to be blocked with “relay not permitted” because exchange sends the mail to the external contact with the original FROM:external@address.com to the external MX.

    Get-DistributionGroup xxxx@xxx.xx | fl rep*
    ReportToManagerEnabled : False
    ReportToOriginatorEnabled : True

    Switch both parameters:

    Set-DistributionGroup xxxx@xxx.xx -ReportToManagerEnabled $true -ReportToOriginatorEnabled $false

    source of solution:
    https://social.technet.microsoft.com/Forums/en-US/cbd9bd18-533e-461e-93ef-113dc30ac7b4/external-mails-to-distribution-groups-not-sent-to-external-contacts-due-no-adressrewriting?forum=Exch2016MFSM

    possible caveat: return-path empty, could not reproduce this problem on Exchange 2013


Follow My Blog

Get new content delivered directly to your inbox.