how to setup DatabaseMail(with MS Exchange Server)
2007-08-06 16:08
555 查看
--SQL Server 2005 Surface Area Configuration
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO
-- Creates a new Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'FISADM',
@description = 'FISADM',
@email_address = 'FISADM@IACP.IAC',
@replyto_address = 'FISADM@IACP.IAC',
@display_name = 'FISADM@IACP.IAC',
@mailserver_name = 'iacp-mail3.iacp.iac',
@port = 25,
@username ='iacp/FISADM',
@password ='XXXX',
@enable_ssl = 0
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'FISprofile',
@description = 'Profile used for FIS.'
-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'FISprofile',
@account_name = 'FISADM',
@sequence_number =1 ;
-- Grant access to the profile to all users in the msdb database
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'FISprofile',
@principal_name = 'public',
@is_default = 1 ; -- later, you can update it through T-SQL: 'update sysmail_principalprofile set ...'
--After this configuration you can send mail by calling the system store procedure dbo.sp_send_dbmail
EXECUTE msdb.dbo.sp_send_dbmail
--@profile_name = 'FISprofile',
@recipients = 'cdq@gmail.com;',
@subject = 'MyDBMAIL',
@body = 'Test Email'
select sent_status,* from msdb.dbo.sysmail_allitems
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO
-- Creates a new Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'FISADM',
@description = 'FISADM',
@email_address = 'FISADM@IACP.IAC',
@replyto_address = 'FISADM@IACP.IAC',
@display_name = 'FISADM@IACP.IAC',
@mailserver_name = 'iacp-mail3.iacp.iac',
@port = 25,
@username ='iacp/FISADM',
@password ='XXXX',
@enable_ssl = 0
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'FISprofile',
@description = 'Profile used for FIS.'
-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'FISprofile',
@account_name = 'FISADM',
@sequence_number =1 ;
-- Grant access to the profile to all users in the msdb database
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'FISprofile',
@principal_name = 'public',
@is_default = 1 ; -- later, you can update it through T-SQL: 'update sysmail_principalprofile set ...'
--After this configuration you can send mail by calling the system store procedure dbo.sp_send_dbmail
EXECUTE msdb.dbo.sp_send_dbmail
--@profile_name = 'FISprofile',
@recipients = 'cdq@gmail.com;',
@subject = 'MyDBMAIL',
@body = 'Test Email'
select sent_status,* from msdb.dbo.sysmail_allitems
相关文章推荐
- How to Export Mailboxes with Exchange Server 2010 SP1(带状态查看,清除请求,归档备份)
- How to Reseed a Failed Mailbox Database Copy in Exchange Server 2010
- how to setup DatabaseMail
- 关于javamail-with-ms-exchange-no-authentication-mechansims-supported-by-both-server错误的解决办法
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server. (文档 ID 885522.1)
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- how to handle with single quote in ms sql server
- Howto Backup PostgreSQL Databases Server With pg_dump command
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to setup a GIT server with gitosis and gitweb
- How to setup Relay host in mail server
- Howto Backup PostgreSQL Databases Server With pg_dump command
- How to use a SQL Server database with your PHP web site
- How to install Oracle Database Server software silently with customized listener configuration
- error while performing databases login with sqlserver driver:unable to create connection
- How to Setup Apache With FastCGI And Ruby Bindings
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- user master page with asp:FormParameter , save only blank data to Database MSAccess