SQL Server 2008 DbMail Reply To and Display Name
August 11, 2010 Leave a Comment
Recently when working with SQL Server and the DBMail option I wanted to setup a generic e-mail account that would fetch the users e- mail address and name for the reply-to. While the reply-to works while sending an e-mail most people find that the display name of the e-mail address is still whatever is setup in your profile. To actually change the display name is not supported by the sp_send_dbmail stored procedure. Kind of annoying. The e-mail the address that displays is not the one that appears when you click “reply” on your e-mail message.
The Workaround
What I ended up doing to overcome this was adjusted my way of thinking. I could’ve probably modified a trigger or stored procedure to edit the profile, I could’ve even just written a service in C# and changed the display name and reply-to there (100% works, I’ve done it in the past, build a mail queue and grab the appropriate settings, then send). Instead this time what I did was created a generic e-mail address account for the company “notifications@company.net” and created a unique profile for them (within the email account and profile setup inside of manage accounts/profiles administration dialog) and set the reply-to the employees e-mail address (within the stored procedure execution).
Not a fix at all but definitely a good workaround in my opinion if the client is ok with this course of action and it’s an easy one time setup, you still get the professionalism with the clients cmpany e-mail name or “spoofed” address appearing and everything works in the end
Final Notes
Again, although I know this is not an actual fix I do offer it as a valid suggestion proposed as a workaround.
Play Big
