How to Send Mail to a SharePoint library using hMailServer?
Question
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..
Solution
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:
- How to Enable Email in Lists
- Also, see my response in this thread.
- How to Enable Email in Lists Without Using Exchange? - here I actually answer my own question.
- How does internal email get to the SMTP client of a SharePoint server? - my answer in this post has links to the hMailServer forum where the vbs scripts can be found.
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.
There is also a thread in the hMailServer forum about this.
[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?
OTHER TIPS
Thanks for your reply. I have added this code in vb script.
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)
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..
Here path is C:\inetpub\mailroot\Drop. I checked permission. It is Ok. In CA, I configured incoming mail setting and give same Path but still not working. Can you elaborate your answer? Is it necessary to start smtp in iis 6.0. I can't start it.