Are you on Azure? I think you have to have SQL Mail setup on the SQL server. Here are a couple of articles discussing how to do that.
This specifically addresses Office365 and database (sql) mail: here's the link to the thread: https://social.technet.microsoft.com/Forums/windows/en-US/b79df1b6-2564-4b8d-8631-ab5b38bbd140/cannot-get-db-mail-to-work-via-smtp-relay-for-office-365-in-sql-server-2014-on-windows-server-2012?forum=sqlkjmanageability
"SQL Database Mail can be configured to send directly to Office 365 (Exchange online). No need of SMTP relay server.
The server name should be set to outlook.office365.com and the port number to 587. Make sure the check box for "This server requires a secure connection (SSL)" is checked.
Email address must be a valid Office 365 email address.
For SMTP authentication use Basic authentication with your Office 365 email as "User name" and your password (the same you used in the "E-mail address" field).
Make sure your firewall is not blocking outbound connections on port TCP 587."
These discuss the old fashioned way of doing it:
How to: Set Up SQL Mail (SQL Server Management Studio)
SQL Server 2008 R2
This topic describes how to use SQL Server Management Studio to set a mail profile for SQL Mail. Before you can use SQL Mail, you must enable SQL Mail. SQL Mail can be enabled by opening the Properties dialog box from the SQL Mail node, by using the Surface Area Configuration facet of Policy-Based Management, or by using the sp_configure stored procedure.
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
To set a mail profile for SQL Mail
- In Object Explorer, expand a server.
- Expand the Management folder.
- Right-click SQL Mail and select Properties. If SQL Mail has not been enabled, you will receive a prompt to enable SQL Mail.
- In the Profile name list, select the mail profile that you configured for SQL Mail. For more information on configuring a mail profile, see How to: Configure Mail Profiles for Use by SQL Mail (Windows).
How to: Configure Mail Profiles for Use by SQL Mail (Windows)
SQL Server 2008 R2
This topic describes how to configure a mail profile for SQL Mail. Before you can use SQL Mail, you must also enable SQL Mail. SQL Mail can be enabled by opening the Properties dialog box from the SQL Mail node of Management Studio, by using the Surface Area Configuration facet of Policy-Based Management, or by using the sp_configure stored procedure.
Note
|
SQL Mail will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use the feature.
|
To configure mail profiles to use to use for SQL Mail
1. On the Microsoft Exchange server, set up a mailbox for the user that SQL Server runs as. This account must be a domain account.
2. Install an Exchange client on the computer that runs SQL Server.
3. Log on to the computer that runs SQL Server. Use the name and password used to start SQL Server.
Note
|
The account used to start SQL Server must be a domain account.
|
4. Start the Exchange client and configure the client to connect to the Exchange server. To do this, you provide the name of the Exchange server and the name of the mailbox created in step 1.
5. In Control Panel, double-click the Mail icon. Click Show Profiles to display the list of profiles on the computer. Find the name of the profile created in Step 4. If the name of the profile is longer than 32 characters, or contains non-alphabetic characters such as pound signs or hyphens, change the name of the profile to be less than 32 characters and contain only alphabetic characters and spaces.
6. Configure SQL Mail to use the profile name specified in step 5. For more information on how to configure SQL Mail to use an existing profile, see How to: Set Up SQL Mail (SQL Server Management Studio).
Send e-mail to yourself using master.dbo.xp_sendmail to ensure that the mail client, mail profile, and e-mail provider are working properly.
Kind regards,
Leslie