Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. exec sys.sp_configure 'show advanced options', 1;
  2. go
  3.  
  4. reconfigure
  5. go
  6.  
  7. exec sys.sp_configure 'Database Mail XPs', 1;
  8. go
  9.  
  10. reconfigure
  11. go
  12.  
  13.  
  14. exec msdb.dbo.sysmail_add_account_sp
  15. @account_name = 'My Account4',
  16. @email_address = 'benjamin.buhagiar.a100465@mcast.edu.mt',
  17. @mailserver_name = 'smtp.outlook365.com',
  18. @port = 587,
  19. @enable_ssl = 1,
  20. @username = 'benjamin.buhagiar.a100465@mcast.edu.mt',
  21. @password = 'mcast371294';
  22.  
  23.  
  24. declare @profid int
  25. exec msdb.dbo.sysmail_add_profile_sp
  26. @profile_name = 'My Profile5',
  27. @description = 'This is the description',
  28. @profile_id = @profID OUTPUT;
  29.  
  30. exec msdb.dbo.sysmail_add_profileaccount_sp
  31. @profile_id = @profid,
  32. @account_name = 'My Account4',
  33. @sequence_number = 1;
  34.  
  35.  
  36.  
  37. exec msdb.dbo.sp_send_dbmail
  38. @profile_name = 'My Profile5',
  39. @recipients = 'benjamin.buhagiar.a100465@mcast.edu.mt',
  40. @subject = 'Test Email',
  41. @body = 'Test Email';
  42.  
  43.  
  44. select * from msdb.dbo.sysmail_mailitems;
  45.  
  46.  
  47. select * from msdb.dbo.sysmail_log;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement