Link to home
Start Free TrialLog in
Avatar of rick
rick

asked on

Sending Email From SQL Server

To enable someone to send email directly from SQL Server, is adding execute permissions on DatabaseMailUserRole the only step?
Avatar of pjam
pjam
Flag of United States of America image

Is SMTP enabled on your server and is that server allowed to send it in your domain?
Avatar of rick
rick

ASKER

>>Is SMTP enabled on your server and is that server allowed to send it in your domain?

Yes
Avatar of David Favor
A better starting question is the destination of sent email.

Sending email is easy.

Having email received (deliverable) is complex.

If you've never done this before, many steps are required + you're best served to start with a service like MailGun.
Avatar of rick

ASKER

Thanks, David.

But I'm going to stick with my original question for now.
If SMTP is enabled, then you should be able to send email.

You might try installing SWAKS (perl script) for help debugging problems.

Depending on what MTA you're running, you may have to dig into your mail logs if mail is queued.

SQL Server doesn't really have anything to do with sending mail. This is handled by the MTA running on your system.

Usually software like WordPress or SQL Server or etc... will submit/queue a message into your MTA + then some point in the future, the queue runner will execute, which will actually connect from your sites to other sites, based on other site's DNS MX records.

Maybe you can give an example of code for sending email from SQL Server + likely someone can assist better.
Avatar of rick

ASKER

What I'm asking is what needs to be done to allow a user to execute this system stored procedure:

 sp_send_dbmail

I believe it is just adding the user to the DatabaseMailUserRole role.  

That's all I'm trying to confirm.  Nothing else.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rick

ASKER

Good resource!  thx