Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Database Mail Expand / Collapse
Author
Message
Posted Tuesday, May 28, 2013 11:49 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, December 15, 2014 2:49 PM
Points: 16, Visits: 98
Im having problems sending mail from an on premise database server to an off premise exchange server with office 365. Has anyone gotten this to work. I can send mail from a script, can send mail using a gmail account, but i get "The mail could not be sent to the recipients because of the mail server failure." when i set it up to send through the online exchange server. I have even tried logging in with that account and sending mail online, so i know that the account works. Any help would be much appreciated.

Thanks
Post #1457465
Posted Wednesday, May 29, 2013 1:01 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, November 6, 2014 8:19 PM
Points: 121, Visits: 1,251
This error occurs either url to the mail server is incorrect or there's no connectivity.

SQL Database Recovery Expert
Post #1457597
Posted Wednesday, May 29, 2013 9:56 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, December 15, 2014 2:49 PM
Points: 16, Visits: 98
Using the same address and options such as SSL, i can send an email successfully using a VB script, ....
Post #1457822
Posted Thursday, May 30, 2013 12:07 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:51 PM
Points: 7,140, Visits: 12,763
You posted in the SQL 7,2000 Forum but I assume you're on a later version if you're using Database Mail. Please confirm.

If in fact you are using Database Mail I have set it up to use a Gmail and a Live/Hotmail account but never an Office 365 account. You might want to check their website to get details about how to use it as a mail relay from an external mail client like Outlook because the settings will be the same for setting up Database Mail.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1458341
Posted Thursday, May 30, 2013 12:15 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, December 15, 2014 2:49 PM
Points: 16, Visits: 98
opc.three (5/30/2013)
You posted in the SQL 7,2000 Forum but I assume you're on a later version if you're using Database Mail. Please confirm.

If in fact you are using Database Mail I have set it up to use a Gmail and a Live/Hotmail account but never an Office 365 account. You might want to check their website to get details about how to use it as a mail relay from an external mail client like Outlook because the settings will be the same for setting up Database Mail.


Yup, your right, i posted it in the wrong place. Im trying to relay to an exchange server / email account hosted on Office 365
Post #1458346
Posted Thursday, May 30, 2013 12:34 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:35 PM
Points: 12,962, Visits: 32,498
we have office365, so i just setup and tested a dbmail using it;
here's the scripted results, which will probably help you a lot:

i was in a rush, and named both the account and the profile the same name, i hope that's not too confusing.

--#################################################################################################
-- BEGIN Mail Settings outlook.office365.com
--#################################################################################################
IF NOT EXISTS(SELECT * FROM msdb.dbo.sysmail_profile WHERE name = 'outlook.office365.com')
BEGIN
--CREATE Profile [outlook.office365.com]
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'outlook.office365.com',
@description = 'outlook.office365.com';
END --IF EXISTS profile

IF NOT EXISTS(SELECT * FROM msdb.dbo.sysmail_account WHERE name = 'outlook.office365.com')
BEGIN
--CREATE Account [outlook.office365.com]
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'outlook.office365.com',
@email_address = 'lowell@mycompanydomain.com',
@display_name = 'Lowell',
@replyto_address = '',
@description = 'outlook.office365.com',
@mailserver_name = 'outlook.office365.com',
@mailserver_type = 'SMTP',
@port = '587',
@username = 'lowell@mycompanydomain.com',
@password = 'NotTheRealPassword',
@use_default_credentials = 0 ,
@enable_ssl = 1 ;
END --IF EXISTS account

IF NOT EXISTS(SELECT *
FROM msdb.dbo.sysmail_profileaccount pa
INNER JOIN msdb.dbo.sysmail_profile p ON pa.profile_id = p.profile_id
INNER JOIN msdb.dbo.sysmail_account a ON pa.account_id = a.account_id
WHERE p.name = 'outlook.office365.com'
AND a.name = 'outlook.office365.com')
BEGIN
-- Associate Account [outlook.office365.com] to Profile [outlook.office365.com]
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'outlook.office365.com',
@account_name = 'outlook.office365.com',
@sequence_number = 1 ;
END --IF EXISTS associate accounts to profiles
--#################################################################################################
-- Drop Settings For outlook.office365.com
--#################################################################################################
/*
IF EXISTS(SELECT *
FROM msdb.dbo.sysmail_profileaccount pa
INNER JOIN msdb.dbo.sysmail_profile p ON pa.profile_id = p.profile_id
INNER JOIN msdb.dbo.sysmail_account a ON pa.account_id = a.account_id
WHERE p.name = 'outlook.office365.com'
AND a.name = 'outlook.office365.com')
BEGIN
EXECUTE msdb.dbo.sysmail_delete_profileaccount_sp @profile_name = 'outlook.office365.com',@account_name = 'outlook.office365.com'
END
IF EXISTS(SELECT * FROM msdb.dbo.sysmail_account WHERE name = 'outlook.office365.com')
BEGIN
EXECUTE msdb.dbo.sysmail_delete_account_sp @account_name = 'outlook.office365.com'
END
IF EXISTS(SELECT * FROM msdb.dbo.sysmail_profile WHERE name = 'outlook.office365.com')
BEGIN
EXECUTE msdb.dbo.sysmail_delete_profile_sp @profile_name = 'outlook.office365.com'
END
*/



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1458356
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse