xp_sendmail with @query parameter

  • quote:


    Do you get valid results for xp_logininfo 'DDDD\blah' ?


    No, I get same error message:

    
    
    Server: Msg 8198, Level 16, State 24, Procedure xp_logininfo, Line 58
    Could not obtain information about Windows NT group/user 'DDDD\blah'.

    However, this is not true. The account is set up correctly in the domain and on the SQL box, and I can log in to the box and the SQL Server through QA with the same account...

  • I'm not sure if this is the same issue, but I have the SQL services and SQL Mail configured for a non-human domain account. When I log on to the database server (or use Ent Mgr to run packages with Send Mail tasks) as a different user account, I get errors.

    If I log off and log on as the same user account under which my SQL services are configured, everything runs perfectly.

    Therefore, when building and testing any processes that include the Send Mail task or xp_sendmail stored proc, I always log on to the SQL server as the SQL server service account.

    This seems to work for me. You might try the same and see if that narrows down your problem.

    Edited by - md40 on 10/21/2003 07:11:31 AM

  • I performed further test on other version of SQLmap70.dll. Version 2000.80.778, 2000.80.811 work too but 2000.80.834 does not work.

    Edited by - allen_cui on 10/21/2003 08:27:12 AM

  • quote:


    quote:


    Do you get valid results for xp_logininfo 'DDDD\blah' ?


    No, I get same error message:

    
    
    Server: Msg 8198, Level 16, State 24, Procedure xp_logininfo, Line 58
    Could not obtain information about Windows NT group/user 'DDDD\blah'.

    However, this is not true. The account is set up correctly in the domain and on the SQL box, and I can log in to the box and the SQL Server through QA with the same account...


    Look at the accounts you sqlserver and agent services run under - if these are not domain accounts, change them to domain accounts and see if you still get the problem.

  • They are domain accounts.

  • works fine on sql2000.

    SENDEMAIL:

    DECLARE @MailSubjectVARCHAR(1000)

    SET @MailSubject = (@var1 +' '+ convert(varchar,datepart(mm,getdate())) + '/' + convert(varchar,datepart(d,getdate())) + ' ' + right(convert (char(19), getdate(), 100), 7))

    IF @EMAILADDRESS IS NULL

    BEGIN

    SET @MailSubject = 'No Email '+ @MailSubject

    EXEC MASTER.DBO.xp_sendmail @recipients=blah@blah.com', -- notify admin

    -- @copy_recipients = @EMAILADDRESS,

    @subject = @MailSubject,

    @message = @MesgInfo

    GOTO ENDPROGRAM

    END

    ELSE

    BEGIN

    SET @EMAILADDRESS = RTRIM(@EMAILADDRESS)

    EXEC MASTER.DBO.xp_sendmail @copy_recipients=blach@blah.com' ,

    @recipients= @EMAILADDRESS, --@EMAILADDRESS,

    @subject = @MailSubject,

    @message = @MesgInfo

    END

  • quote:


    works fine on sql2000.

    SENDEMAIL:

    DECLARE @MailSubjectVARCHAR(1000)

    SET @MailSubject = (@var1 +' '+ convert(varchar,datepart(mm,getdate())) + '/' + convert(varchar,datepart(d,getdate())) + ' ' + right(convert (char(19), getdate(), 100), 7))

    IF @EMAILADDRESS IS NULL

    BEGIN

    SET @MailSubject = 'No Email '+ @MailSubject

    EXEC MASTER.DBO.xp_sendmail @recipients=blah@blah.com', -- notify admin

    -- @copy_recipients = @EMAILADDRESS,

    @subject = @MailSubject,

    @message = @MesgInfo

    GOTO ENDPROGRAM

    END

    ELSE

    BEGIN

    SET @EMAILADDRESS = RTRIM(@EMAILADDRESS)

    EXEC MASTER.DBO.xp_sendmail @copy_recipients=blach@blah.com' ,

    @recipients= @EMAILADDRESS, --@EMAILADDRESS,

    @subject = @MailSubject,

    @message = @MesgInfo

    END


    The posted question is in regards to the @query parameter of xp_sendmail, which is apparently the source of the issue.

  • I found @query parameter a little bet an logical in xp_sendmail. @recipient, @subject etc. have their place there. One way to get around it is pass query as a parameter to xp_sendmail, like in my example @MailSubject or @emailaddress which is result of another query. It just my thoughts.

  • I think you should try and solve the xp_logininfo issue first. It looks like xp_sendmail is trying to validate the username who is executing the query. My problems with xp_logininfo was because the startup accounts were not domain accounts, but I remember that there were other causes for this as well. Unfortunately I cannot find the link right now, but it had something to do with the fact that NT groups (local or domain) were created with the same name as default windows groups or with the name 'everyone'.

  • Has anyone ever solved this issue?

    I have 30 SQL Servers here all setup idecticle.

    2 of the 30 have this problem. The articles from Microsoft are useless as usual.

    This is obviouly some security setting beyond SQL.

    Anyone come up with any ideas?

Viewing 11 posts - 16 through 25 (of 25 total)

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