Configure hMailServer for SharePoint

Nice article from Wesley Bakker on how to use hMailServer for SharePoint: http://weblogs.asp.net/wesleybakker/archive/2010/08/09/configure-hmailserver-for-sharepoint.aspx

In Short:
Authentication
SharePoint cannot authenticate to an SMTP server, so you need to disable authenctiaction on the hMailServer (at least for the local computer)

  • In Settings / advanced / IP Ranges add an IP range (either the ip of the server or simply 0.0.0.0 – 255.255.255.255) and disable ‘Require SMTP authentication’.

Drop folder
If you’re not using the build-in SMTP service, you need to configure SharePoint incoming mail to use a dropfolder. Also, SharePoint relies on the x-sender and x-receiver headers to process the mail. hMailServer does not add these messages, so these need to be added

  • Create a [dropfolder] and make sure the SharePoint Timer Service has read/write/modify access to it.
  • Configure hMailServer’s scripts (Settings / Advanced / Scripts) to handle the OnDeliverMessage event.
  • Use the following script
  • Sub OnDeliverMessage(oMessage)
        Dim path, filename, fso, original, copy
        path = Split(oMessage.Filename, “\”, -1, 1)
        filename = “[dropfolder]” & path(UBound(path))
        Set fso = CreateObject(“Scripting.FileSystemObject”)
        Set copy = fso.CreateTextFile(filename, True)
        copy.WriteLine(“x-sender: ” & oMessage.FromAddress)
        copy.WriteLine(“x-receiver: ” & oMessage.To)
        Set original = fso.OpenTextFile(oMessage.Filename, 1)
        copy.WriteLine(original.ReadAll)
        copy.Close
        original.Close
    End Sub

  • Configure SharePoint incoming mails to point to the [dropfolder]
  • Optionally configure hMailServer with a catch-all address (Domains / / Advanced tab) so you don’t have to create an account for each Email Enabled library you use in SharePoint.

The script will copy ALL emails to the dropfolder. Emails that are not intended for SharePoint will simple be ignored by SharePoint.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>