SharePoint 2010 Email problems

Today I bring a problem that struck me for a couple of days. The thing is the following:

We have a SharePoint 2010 farm where works like a charm, but recently a client calls me complaining about the email direction that appears in the email alerts, access requests and things like that. The emails were sent by the preproduction account instead of the production account.

My first impression was: It’s not possible, so my first movement was to double check the direction stated in System Settings -> Outgoing email. All was correct, the problem started to be weird, so I decided to change the email direction and try to do some tests: I tried to create an alert in a library (with no luck), request access (with no luck) and even to use powershell commands to send an email (with no luck)

$site = New-Object Microsoft.SharePoint.SpSite("http://appweb.com")
$web = $site.OpenWeb()
$sent = [Microsoft.Sharepoint.Utilities.SpUtility]::SendEmail($web,0,0,"destinationemail@dest.com","Test PRO mail subject","PRO test mail body")
$sent

All the mails were sent with the PREproduction account, so I started to be worried about this. Next thing I thought was, ok if configuring the parameters on CA works, it will work with PS, so my next step was to execute the following command:

$SMTPServer = "smtp.server.com"
$EmailAddress = "email@address.es"
$ReplyToEmail = "email@address.es"
Try
{
Write-Host -ForegroundColor White " – Configuring Outgoing Email…"
$loadasm = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$SPGlobalAdmin = New-Object Microsoft.SharePoint.Administration.SPGlobalAdmin
$SPGlobalAdmin.UpdateMailSettings($SMTPServer, $EmailAddress, $ReplyToEmail, 65001)
}
Catch
{
Write-Host "Failed"
}

Nothing, again with the same luck as before, so I was starting to be running out of ideas, but suddenly I remembered that is still possible to use stsadm commands, so I checked the commands and I realized that was possible to configure an email address for a web application in concrete, it was my last bullet, so I was crossing my fingers:

stsadm -o email -outsmtpserver smtp.server.com -fromaddress email@address.es -replytoaddress email@address.es -codepage 65001 -url http://webapp.com

And…. yiiiiha!! The problem was solved, all the mails were being received with the last account I configured, I still thinking that it is a bit weird, but the problem was solved by the moment, so let’s pass to another thing.

Hope it helps!

Advertisement

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 )

Facebook photo

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

Connecting to %s