Incoming Email ServerName whoops!

This post is in regards to WSS 3.0/MOSS 2007 but I’m sure the same applies in 2010.

I’m working on a project in which we’re handling responses from users via an email enabled list, that will then programmatically take action on a workflow task on behalf of the user.  This is so the business users can approve/reject a given task on their mobile devices without having to be physically connected to the companies internal network.

In the email body that we’re generating for the response, we’re generating the reply to address for the email as <listalias>.<hostingserver> where listalias is the name we’ve configured on the incoming email settings for the list, and hostingserver is the host address for the SharePoint server which is handling incoming email.

The problem was I was using the ServerAddress property of the SPIncomingEmailService instance to get the server address (Which might naturally be your first choice), such as the following:

String serverAddress = Microsoft.SharePoint.Administration.SPFarm.Local.Services.GetValue<Microsoft.SharePoint.Administration.SPIncomingEmailService>().ServerAddress;

but that doesn’t give you the actual name configured in the Incoming Email settings in Central Admin (Operations/Incoming e-mail settings/E-mail server display address).  To get that value, you need to use ServerDisplayAddress.

Just thought I would share

– Keith

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s