4

Hey all,
just quick question about sql azure. My App is running on windows azure and the database is on sql azure. Everything is working great. However, I would like to send email to a user, as soon as he\she became a member.I don't want to Use

    - third party service
    - send email from the code.

Is there any way to send email by using a trigger and stored procedure? For example: run trigger after each updated for user table and trigger will run stored procedure. Thanks in advance . Matt

Matt
  • 41
  • 1
  • 2
  • Does this answer your question? [How to configure mail on Azure SQL Database](https://stackoverflow.com/questions/54782922/how-to-configure-mail-on-azure-sql-database) – Michael Freidgeim Dec 01 '19 at 19:25

3 Answers3

3

As far as I know, there is no way to send an email from SQL Azure directly. You will have to use a web, worker or VM role to actually send email. In general, sending email from Azure data centers is tricky because spam filters flag Azure IP addresses as unsafe (see https://alinirimie.sys-con.com/node/1404827). To avoid this problem, you must use a third party SMTP service (we use Amazon SES) or your own SMTP server. If you want to connect to your own SMTP server through a firewall, you can use Windows Azure Connect to establish a secure tunnel from Azure to your local network.

Jonathan McIntire
  • 2,665
  • 23
  • 26
2

I realize you stated that you do not want to use a 3rd party services, but for others that might be reading this and would be open to this. Cotega allows you to send emails directly from SQL Azure.

Full disclosure, I work on Cotega.

Cotega
  • 339
  • 1
  • 2
  • 8
1

There is some documentation on hacks you can do here: http://vpolizzi.wordpress.com/2010/09/11/database-mail-on-sql-azure/

However I think using a worker role would be more robust and maintainable.

Sam Saffron
  • 128,308
  • 78
  • 326
  • 506