Things to consider:
- Set up Exchange Online as an SMTP Relay Using Windows Server 2012
- Configure IIS 8 relay SMTP
- How to configure Internet Information Server (IIS) for relay with Office 365
- Add the SMTPRELAY to the server pool (the sql server where I am running SSIS packages which is using SMTPRELAY server)
I had a SSIS package which included “Send Email Task”. I uploaded the SSIS package to SQL MSDB and ran as a SQL job and I was getting the following error message:
Executed as user: SHELTER\SSIS_Admin. Microsoft (R) SQL Server Execute Package Utility Version 12.0.4100.1 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 20:30:01 Error: 2015-12-01 20:30:02.07 Code: 0xC002F304 Source: WFT START EMail Send Mail Task Description: An error occurred with the following error message: “Unable to send to all recipients. System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for Masud_Ahmed@shelter.org.uk”. End Error Error: 2015-12-01 20:30:02.07 Code: 0xC002F304 Source: Send Mail Task Send Mail Task Description: An error occurred with the following error message: “Mailbox unavailable. The server response was: 5.7.1 Unable to relay for Luke_came@shelter.org.uk”. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 20:30:01 Finished: 20:30:02 Elapsed: 0.812 seconds. The package execution failed. The step failed.
The SMTP Server is not set up properly. This is an error from the SMTP Server and not SSIS error.
Basically, on SMTPRELAY server IIS was already setup to work as a smtp relay server still it was not working because on smtp IIS there was an access list of which server can use the smtp service and my server was not on that list. After adding my server on IIS–>SMTP–>Right click properties–>Access tab–>Add–>Enter ip address of the our server; it has worked.