Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2010
    Posts
    36

    Unanswered: How to send an email using msdb.dbo.sp_send_dbmail without a profile name?

    Hi folks,

    I am currently migrating from MSSQL 2000 to MSSQL 2008.

    Before, we were using the master.dbo.sp_send_cdosysmail stored procedure to send an email from a Web application. I discovered that this stored procedure does not work anymore in MSSQL 2008. I need to use msdb.dbo.sp_send_dbmail, which is quite similar to the old one.

    Everything works fine now but I found a little glitch that I would like to fix, if possible.

    I created a profile under Management > Database mail

    When I use the following code:
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'MYPROFILE',
    @from_address = 'MY_EMAIL_ADDRESS',
    @recipients = 'MY_EMAIL_ADDRESS',
    @subject = 'test',
    @body_format = 'HTML',
    @body = '123456789'

    I receive an email, but the sender's name is the one specified in the profile.
    For instance :
    From : MYPROFILE NAME [MY_EMAIL_ADDRESS]
    To : My name
    Subject : test
    Message content : 123456789

    What I would like to see is:
    From : My name(or the user's name) [MY_EMAIL_ADDRESS] OR simply MY_EMAIL_ADDRESS
    To : My name
    Subject : test
    Message content : 123456789

    ... just like the good old way I was used to use in MSSQL 2000.

    I also have another situation that is quite annoying. Let's say the email is sent to a mailbox using that same stored procedure. The Exchange mailbox is sending back an acknowledgement receipt to the email address specified in the default Database mail profile, which is WRONG! I want the acknowledgement receipt to be sent to the client that submitted the service request from the Web.

    Any thoughts?

    Thank you
    Last edited by CharleyDC5; 04-01-11 at 13:50.
    Charles M.
    DB2 DEV server : DB2 Express-C / Windows 2008 Server Standard Edition
    DB2 PROD server : DB2 9.5 Workgroup / Windows 2008 Server Standard Edition

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •