SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Mail


Database Mail

Author
Message
coreyjbaum
coreyjbaum
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 269
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
prettsons
prettsons
Mr or Mrs. 500
Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)

Group: General Forum Members
Points: 594 Visits: 1388
This error occurs either url to the mail server is incorrect or there's no connectivity.

SQL Database Recovery Expert :-)
coreyjbaum
coreyjbaum
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 269
Using the same address and options such as SSL, i can send an email successfully using a VB script, ....
Orlando Colamatteo
Orlando Colamatteo
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14857 Visits: 14396
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
coreyjbaum
coreyjbaum
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 269
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
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28040 Visits: 39926
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search