Dimitri
Dimitri

Reputation: 8280

Sending a mail from SQL Server?

is it possible to send an email with SQL Server? I would like to be able to create a procedure for sending an email. It seems that I have to do some configuration according to this site but I don't have admin access on my machine. How can I achieve that ?

Thanks for your help !!

P.S : I am working on Windows

Upvotes: 0

Views: 279

Answers (3)

Simen S
Simen S

Reputation: 3205

If you have limited privileges on the SQL Server why don't you write the query to obtain the users' names, email adresses and forgotten DVD titles and send the email from you application?

As long as you have access to an SMTP server you should be good to go.

Or you could always try the obvious:

 USE YourDB;
 GRANT CONTROL SERVER TO ME AS (JON_SKEET OR CHUCK_NORRIS);
 GO

:-)

Upvotes: 2

RB.
RB.

Reputation: 37172

xp_sendmail is the command you want for older versions of SQL Server. Note that this is being removed from future versions, so for versions which support it use Database Mail.

EDIT Sorry - just read your full post. If you don't have the rights to enable mail sending, you'll need to speak to the admin who has. Server security is not designed to be "worked-around". Why does the mail have to be sent from SQL Server?

Upvotes: 1

Paolo Falabella
Paolo Falabella

Reputation: 25834

You could use a CLR Stored Procedure. See this example for instance: Send Email from SQL Server Express Using a CLR Stored Procedure

Sending it via .NET would allow you to relay on a external SMTP and not having to configure Database Mail.

Upvotes: 1

Related Questions