-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.sql
More file actions
22 lines (19 loc) · 851 Bytes
/
mail.sql
File metadata and controls
22 lines (19 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Crear una cuenta de Database Mail
EXEC msdb.dbo.sysmail_add_account_sp
@account_name = 'NombreCuentaCorreo',
@email_address = 'tuCorreo@example.com',
@mailserver_name = 'smtp.example.com'; -- Cambia esto por tu servidor SMTP
-- Crear un perfil de Database Mail
EXEC msdb.dbo.sysmail_add_profile_sp
@profile_name = 'NombrePerfilCorreo',
@description = 'Perfil de correo para envío de emails';
-- Asociar la cuenta al perfil
EXEC msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'NombrePerfilCorreo',
@account_name = 'NombreCuentaCorreo',
@sequence_number = 1;
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Adventure Works Administrator',
@recipients = 'yourfriend@Adventure-Works.com',
@body = 'The stored procedure finished successfully.',
@subject = 'Automated Success Message' ;