is there an sp_sendmail reply-to?

Posted on 2007-10-19
Medium Priority
Last Modified: 2010-05-18
I want to be able to change the reply-to address of emails sent from SQL Server but I can't see how to.

Is there a way to do this?

We are running SQL Server 2000.
Question by:purplesoup
  • 4
  • 3
  • 2

Expert Comment

ID: 20109007
The parameters of sp_sendmail are:

EXEC sp_SendMail @SMTPServer, -- smtp server address
            @From,       -- From e-mail address
            @FromName,   -- From friendly name (uses e-mail address if null)
            @AddAddress, -- Comma delimited Address list
            @CCAddress,  -- Comma delimited CC list
            @Subject,    -- EMail subject
            @Body,       -- EMail body
            @Err         -- Output Contains '0' if successful,
                         -- Actual error text if failure

Use the @from parameter to change the reply address.

Author Comment

ID: 20109027
When I try using the @From parameter I get

Msg 17981, Level 16, State 1, Line 0
xp_sendmail: Invalid parameter '@From'

Author Comment

ID: 20109051
Looks like this is using XP_SMTP_SendMail
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 20109124
Well xp_smtp_Sendmail has these parameters:

    @FROM = @FROM,
    @TO = @TO,
    @replyto = @replyto,
    @CC = @CC,
    @BCC = @BCC,
    @priority = @priority,
    @subject = @subject,
    @message = @message,
    @messagefile = @messagefile,
    @type = @type,
    @attachment = @attachment,
    @attachments= @attachments,
    @server = @server,
    @codepage = @codepage,
    @timeout = @timeout

Author Comment

ID: 20109317
yes it does, but we don't have it installed on the server I am using.

I guess the answer could be you just can't do it with sp_sendmail.

Expert Comment

ID: 20109399
LVL 15

Expert Comment

ID: 20109690
"Looks like this is using XP_SMTP_SendMail"
"... but we don't have it installed on the server I am using."

Conflicting statements. How can you be using XP_SMTP_SendMail if you don't have it installed. If it has not been registered to the server, check out the instructions for installing and registering it at http://www.sqldev.net/xp/xpsmtp.htm.

Author Comment

ID: 20121750
Let me just summarise the story so far.

When I asked about sp_sendmail I was referring to the standard SQL Server function.

Someone replied saying it was possible using the @From parameter, but this turned out to be a parameter on a function called XP_SMTP_SendMail. The phrase

"Looks like this is using XP_SMTP_SendMail"
"... but we don't have it installed on the server I am using."

was simply saying the answer someone gave was using the XP_SMTP_SendMail function, but we don't have it installed on our server. We just have the standard SQL Server functions.

There do appear to be some pages that refer to an sp_SendMail function that has an @SMTPServer parameter and a @From parameter - for example the link provided by sjturner2, however this sp_SendMail appears to *not* be the standard function, but one supplied by aspemail.

Can I conclude from this that there is no way, using the standard mailing functions that come with SQL Server, to specify a reply-to address?

It would be nice to just have this confirmed before I start looking at what the best alternative is.

LVL 15

Accepted Solution

dbbishop earned 2000 total points
ID: 20123160
Sorry, I misunderstood. You are correct. xp_sendmail uses an email client and uses the account to which that client has been linked as the FROM address. There is no way to override it in xp_sendmail. The best you could do is see about installing XP_SMTP_SendMail. You might also check out using CDO (http://support.microsoft.com/kb/312839).

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question