Trick for sending Database Mail

Database mail is very cool in SQL Server 2005. The problem that I have is that I want to send alerts to an account other than in my domain or exchange server; most Exchange Servers by default don't allow you to send any sort of forwarded or anonymous email because of these guys that want to send spam to everyone. So, if for instance I have created a profile with an address on my smtp server mail@myserver.com, I can only send database mail alerts to myserver.com unless I open up the mail server (not likely to happen). Only the local and known recipients can receive database alerts. However, here's a simple fix for bypassing this and getting mail to work for you.

 

STEP 1  - Get a gmail account - gmail allows for forwarding...very nice!

 

STEP 2 - Set up your new profile (I'll walk through all of this again even thought it's well documented every place imaginable on the internet)

 

 

STEP 3 - Configure mail

For my mail account, I called it SQLDBAAlert. I used a generic gmail account, and created a display name that tells me what the email message is, and what server it was generated from. (I can never tell, so I just add it in the mail message). Reply, just leave this one out. Server name for gmail is smtp.gmail.com, and port number is 587. You can also try 495, but this one seems to work well for me. Very important is to add the "This server requires a secure connection (SSL)"...simply because it does.  Finally, for authentication, add Basic authentication, and give it your mail address (username), password, and confirmation.


Click OK and you have a mail profile and account complete.

 

 


STEP 4
 - Try it out

 

 

 

Scouring the internet, this should be just the trick for a lot of people. Hope this helps you a bit, and assists you in getting by the nagging rule that only your local domain email addresses can receive alerts from Microsoft SQL Server and the database mail facility. One thing that you might test - if your email looks something like no_reply.mail@gmail.com it might not work for you. Seems to not like the no_reply verbiage, but check it out and let me know.

Lee

----------------------------

Hmmm. Wondering if I should bombard my ex-wife with email?

 


Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading




by Lee Everest, M.S.

Search


Ads

Calendar

«  July 2010  »
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
View posts in large calendar

Tags

Disclaimer
The opinions, code, examples, et.al. expressed herein are my own personal opinions and do not represent my employer's view in any way, shape form, or fashion.  All code for demonstration purposes - no guarantees, either written or implied, are made.

© Copyright 2010 Lee Everest's SQL Server, etc. weblog