# How to Send Mail to a SharePoint library using hMailServer?

How can i send mail from hmailSserver to a SharePoint library ? I work on Windows Server 2008. When an email is sent from Outlook I can't find it in the library..

-
Did you setup incoming email for the sharepoijnt server? if so please specify the config: SP SMTP: email Alias hMailServer: Configuration of Domains SharePoint: Incoming Email Setting from CA –  Marco Scheel Dec 18 '12 at 15:17
Add SMTP logging (in IIS) and check if emails are droped into the drop folder on sharepoint. Check ULS Logs. The OWS Timer will report is a email was proccessed. Turn up trace level logging to se what the excact problem is. and report back –  Marco Scheel Dec 18 '12 at 15:19

I use hMailServer with Sharepoint.

Since I have worked with this to a good degree, I have a few threads in these forums that would be of service to you:

Now, I'll tell you that there is a bit of a trick to it. You have to configure hMailServer with a vbs script to drop the mail into a location where SharePoint can pick it up. In my posts there is a link to the script to use for hMailServer. You also need to make sure you have configured your mail pickup in SharePoint's Central Administration. In my case, hMailServer was on one machine and SharePoint on another. So I also had to configure a shared directory between the two machines to use as the dropoff folder.

[update]

In Central Administration > System Settings > Configure Incoming Email there is a place to designate where your "E-mail drop folder" is. This is where you want hMailServer to put is messages. SharePoint will take any messages you put in that folder and sift them and deliver them to the appropriate lists.

The best way, with hMailServer is to add a subdomain. Say your primary domain is mydomain.com where your email address would be me@mydomain.com. In hMailServer, create a second one called portal.mydomain.com where email for the portal lists would be list1@portal.mydomain.com. Now, in the vbs script, you look for any messages going to the subdomain and move them to the drop folder for SharePoint to pick up.

However, you also have to go into the list's own settings and enable it to receive email there.

Since you are enabling email for lists, you should also set up the SMTP Virtual Server on the machine hosting SharePoint. This is what IIS6 is for. You point it to your hMailServer using the subdomain mentioned above. That will allow your portal to SEND email, too. I posted links to directions on how to configure IIS6 in this thread.

Another thing you need to do, if you haven't already, is to configure your DNS Server with an mx record to use hMailServer as the mail handler. There is more information about this in the hMailServer forum.

Here path is C:\inetpub\mailroot\Drop.

Is that path accessible to both hMailServer AND SharePoint? Did you set that path in SharePoint's SCA as I mentioned above?

-
Thanks for your reply. I have added this code in vb script. –  Rajesh Joshi Dec 19 '12 at 5:49
@RajeshJoshi - Just curious, what exactly was the fix? –  BGM Dec 21 '12 at 15:21

Sub OnDeliverMessage(oMessage) Dim path, filename, fso, original, copy path = Split(oMessage.Filename, "\", -1, 1)

filename = "C:\inetpub\mailroot\Drop\" & _
path(UBound(path))

Set fso = CreateObject("Scripting.FileSystemObject")

Set copy = fso.CreateTextFile(filename, True)

Set original = fso.OpenTextFile(oMessage.Filename, 1)