Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | andyc209Starting Member
 
 
                                        5 Posts | 
                                            
                                            |  Posted - 2010-07-30 : 11:40:28 
 |  
                                            | I have Database mail configured and working from the MSDB database, however I want to run queries out of another database and send these out on Email - excuse my ignorance but how can i get Database Mail to work from another database (all my data is in database called MYDATA) but when I change the 'use [MSDB]' to 'use [MYDATA]' obviously all the Stored Procs to do with Database Mail are missing.any help for a novice is much appreciated |  |  
                                    | tkizerAlmighty SQL Goddess
 
 
                                    38200 Posts |  |  
                                    | kencheeStarting Member
 
 
                                    49 Posts | 
                                        
                                          |  Posted - 2010-08-02 : 20:48:33 
 |  
                                          | Hi,   the query that you use on the other database, what you can do is to use this sql command EXEC msdb.dbo.sp_send_dbmail		@profile_name = <database mail profile>,		@recipients = <email address of the recipient>,		@copy_recipients = <cc email address>,		@subject = <email subject>,		@body = <email message>,		@body_format = <can be html or text>The other thing to check is to ensure the user you are using to execute this query has permissions to "DatabaseMailUserRole" in the msdb database.hope this helps |  
                                          |  |  |  
                                |  |  |  |