--1- I
copied the three mentioned file.
--2-
executed : dbo.sysmail_start_sp and dbo.sysmail_stop_sp
--3-
Configured "Database Mail XPs' using (refering the comment by "John
Hunter"):
--To fix
the run the following script:
USE Master
GO
sp_configure 'show advanced options',
1
GO
reconfigure with override
GO
sp_configure 'Database Mail XPs', 1
GO
reconfigure
GO
sp_configure 'show advanced options',
0
GO
--4-
created the a profile and set it as default:
-- Create
new profile
EXECUTE
msdb.dbo.sysmail_add_profile_sp
@profile_name = 'DoNotReply',
@description = 'Profile to send the
notification emails'
GO
-- Set
the New Profile as the Default
EXECUTE
msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'DoNotReply',
@principal_name = 'public',
@is_default = 1 ; -- Make this the default profile
GO
--5-
created the account as:
EXECUTE
msdb.dbo.sysmail_add_account_sp
@account_name = 'DoNotReply',
@description = 'my email description',
@email_address = 'DoNotReply@mydomain.com',
@display_name = 'My email display name',
@replyto_address = null,
@mailserver_name = 'mail.mydomain.com',
@username = 'DoNotReply@mydomain.com',
@password = 'my_password',
@port = 25, -- Check with your admin for correct port
@enable_ssl = False -- Enable ssl
communication
--6-
Added account to the profile:
EXECUTE
msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'DoNotReply',
@account_name = 'DoNotReply',
@sequence_number = 1
GO
--7-Made
sure the define port (25 in my case) is allowed in the server.
--8- Test
:
EXECUTE
msdb.dbo.sp_send_dbmail
@recipients='receipient@recipientdomain.com',
@subject = 'Test e-mail sent from
database mail',
@body = 'This is a test message
sent from the newly created database mail account',
@reply_to = 'info@mydomain.com'
GO
No comments:
Post a Comment