I’ve hit a snag while setting up email for SQL Server Reporting Services (SSRS) with Office 365. Here’s the deal:
The PowerShell test works fine. I used this script:
$creds = New-Object PSCredential 'myemail@company.com', (Get-Content 'C:\secret.txt' | ConvertTo-SecureString)
$mailParams = @{
SmtpServer = 'smtp.office365.com'
Port = 587
UseSsl = $true
Credential = $creds
From = 'myemail@company.com'
To = 'recipient@example.com'
Subject = 'Test Email'
Body = 'SMTP test from Office 365'
}
Send-MailMessage @mailParams
This works great, so I know my O365 setup and network are okay.
But SSRS won’t send emails. I’ve tried different settings in the rsreportserver.config
file, like:
<RSEmailDPConfiguration>
<SMTPServer>smtp.office365.com</SMTPServer>
<SMTPServerPort>587</SMTPServerPort>
<SMTPAccountName>myemail@company.com</SMTPAccountName>
<SMTPUseSSL>True</SMTPUseSSL>
<SendUsing>2</SendUsing>
<SMTPAuthenticate>1</SMTPAuthenticate>
<SendUserName>[encrypted]</SendUserName>
<SendPassword>[encrypted]</SendPassword>
<From>myemail@company.com</From>
</RSEmailDPConfiguration>
SSRS keeps giving me this error: ‘Failure sending mail: At least one error has occurred. Mail will not be resent.’
Any ideas what I’m missing here? The PowerShell test works, but SSRS won’t play ball. Help!