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.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 email

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-14 : 06:07:16
Hi,
I am able to send a test email from Database Mail under the management folder in management studio.
BUT, I am unable to send email Using the following sql:
Do you know why please?

xp_sendmail 'myemailaddress', 'test for Dev from Query Analyser'
The error message is:
SQL Server blocked access to procedure 'sys.xp_sendmail' of component 'SQL Mail XPs' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'SQL Mail XPs' by using sp_configure. For more information about enabling 'SQL Mail XPs', see "Surface Area Configuration" in SQL Server Books Online.

I am unable to get to the Surface Area configuration as tehre is no menu for it in start, All Program.
Any suggestions please?
Thanks

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-11-14 : 06:15:41
yes, you need to either use sp_configure to allow access to xp_sendmail or use sp_send_dbmail, I would go with sp_send_dbmail.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-14 : 06:28:18
use below to enable xp_sendmail

sp_configure 'Database Mail XPs',1
RECONFIGURE


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-14 : 06:31:53
i also prefer sp_send_dbmail to xp_sendmail as former is SMTP based and also can be rolled back in case of failures

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-14 : 06:36:08
Could not find stored procedure 'sp_send_dbmail'.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2011-11-14 : 06:53:42
quote:
Originally posted by visakh16

i also prefer sp_send_dbmail to xp_sendmail as former is SMTP based and also can be rolled back in case of failures

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Nowt sure what you mean by rollback ?

PBUH

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-14 : 07:10:31
quote:
Originally posted by arkiboys

Could not find stored procedure 'sp_send_dbmail'.


are you using sql 2000?
'sp_send_dbmail' is only available from sql 2005 onwards

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-14 : 07:16:18
quote:
Originally posted by Sachin.Nand

quote:
Originally posted by visakh16

i also prefer sp_send_dbmail to xp_sendmail as former is SMTP based and also can be rolled back in case of failures

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Nowt sure what you mean by rollback ?

PBUH




if used inside transaction if transaction is rolledback send mail action will also be rooledback which is not the same in case of xp_sendmail

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2011-11-14 : 11:17:38
I am not understanding it correctly.

So what you are saying is that if I have a send mail in a transaction and in that transaction suppose I am sending mails to say like 10 recipients and doing a couple of Inserts and updates and and on the 8th recipient my transaction rollbacks so all the mails sent to those 8 recipient will be like....rolled back ???

PBUH

Go to Top of Page
   

- Advertisement -