DMail

  • I haven't used DB Mail much yet in 2005. I have it working and it seems to work just fine with 1 little draw back.

    I've been through the help screens on the procedure and I don't find any option to specify the Reply To EMail adress.

    Is there any way to do this short of modifying the profile being used in MSDB?

    Todd Fifield

  • Do you mean you want to have a different reply-to e-mail when you fire off sp_send_dbmail than the one in the profile? If so, I don't think you can do that directly.

    You could, of course, update the profile, fire the send-proc, then change the profile back.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I believe that you can also have multiple profiles, so you could setup a non-default profile that had your special ReplyTo address and then just specifiy that profile when you send.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • tfifield (7/22/2008)


    I haven't used DB Mail much yet in 2005. I have it working and it seems to work just fine with 1 little draw back.

    I've been through the help screens on the procedure and I don't find any option to specify the Reply To EMail adress.

    Is there any way to do this short of modifying the profile being used in MSDB?

    Todd Fifield

    Here is a link to some posts on my blog about Database Mail, http://wiseman-wiseguy.blogspot.com/search/label/Database%20Mail. In there are links to a forum post and a MS Connect Issue I logged about it.

    Basically this is a known issue in SQL Server 2005 and was actually fixed in Cumulative Update Package 8, http://support.microsoft.com/kb/953841/en-us and has been fixed in SQL Server 2008.

    You still need to use the profile I think. Although, since I have not installed Cumulative UPdate Package 8, there may be a ReplyTo parameter on the sp now.

  • Thanks Guys,

    I'm afraid the multiple profiles will be difficult for my client to maintain. They seem to have people come and go and they want the the Reply To address to be whoever sends the EMail.

    The users can use whatever EMail client program they want to - Outlook, Thunderbird, etc., so handling it in the front end program could be difficult.

    I guess I'll have to modify the profile, send the EMail and then modify it back (and hope there's no concurrency problem).

    Todd Fifield

  • I'm confused now. If they're using Outlook to compose an e-mail, why use DBMail to send it? Or am I misunderstanding something?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • The EMail is not being composed by the user. They want to be able to click a button in the front end program and automatically send a PDF file to a client with their own EMail address as the Reply To.

    Todd Fifield

  • Why to you want to use SQL Server's mail system to send the file then? There are ways in .NET and I'm sure Java as well to send email via smtp, why not use that?

  • Good question Jack. The front end application is already written in Access. Using DB Mail seemed like the easiest way to send this type of EMail automatically - just pass the recipient's EMal address, a template kind of subject and message and the path to an attachment to a stored procedure and send it.

    I have interfaced to Outlook with VBA to send EMail and this works, although since Outlook 2003 there's a nasty little message from Outlook where the user has to click on 'OK' to allow it to be sent. The main problem is that the users can be using any EMail client they feel comfortable with. Some use Outlook, some use Thunderbird. Some users run the Access program from Terminal Services. It's just kind of messy to try to hook into their individual EMail programs.

    The .Net framework is installed on the SQL machine. I haven't yet done any development in .Net. Do you think it would be relatively simple to invoke some sort of VB script to do the dirty work of sending the EMail?

    Todd Fifield

  • I don't think it would be too difficult to do in VB.NET. You could write a CLR procedure that handles this. I really think MS missed the boat a bit on DBMail. It is much better than SQLMail, but you should not have to a have a profile and account setup to set the properties. There was free extended stored procedure available for SQL 7, 2000 that was really easy to use (xp_smtp_sendmail) and allowed you to set all the properties, including smtp server at run-time.

  • tfifield (7/22/2008)


    I'm afraid the multiple profiles will be difficult for my client to maintain. They seem to have people come and go and they want the the Reply To address to be whoever sends the EMail.

    Well then, they already have to create new domain accounts for these people, plus give them the necessary domain rights, access to the application and access to the SQL server, plus setup the individual mail profiles outside of SQL server. I don't see how adding a DBMail profile setup to this is much more work.

    And now that I think about it, if they have so many people leaving all the time, is it really a good idea for the "ReplyTo" to be to their personal accounts? Most companies I know in that situation have the ReplyTo's set to a fixed profile based on the position (i.e. "Claims Adjuster 331"), NOT the person's name.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Jack, thanks for the quick reply. Do the extended SProcs that ran on V7 and 2000 run on 2005?

    Also, I've never done any CLR programming. Any pointers on how to get started?

    Todd Fifield

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply