SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Error using sp_send_dbmail


Error using sp_send_dbmail

Author
Message
Joie Andrew
Joie Andrew
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2399 Visits: 2032
I agree with Paul. Your error seems to indicate that you need a Windows login to send the mail and not a SQL login. Can you add a Windows login to your instance and test it and let us know if it works or not?

Joie Andrew
"Since 1982"
Peter Gadsby
Peter Gadsby
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 305
I dont understand why we don't get the error 'files requires an integrated client login.'

We can use a local login to send an email with an attachment!

Pete

Peter Gadsby
Business Intelligence Consultant
www.hgconsult.co.uk
Paul White
Paul White
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16330 Visits: 11355
Peter Gadsby (11/10/2009)
I dont understand why we don't get the error 'files requires an integrated client login.'
We can use a local login to send an email with an attachment!

Books Online
Database Mail uses the Microsoft Windows security context of the current user to control access to files. Therefore, users who are authenticated with SQL Server Authentication cannot attach files using @file_attachments. Windows does not allow SQL Server to provide credentials from a remote computer to another remote computer. Therefore, Database Mail may not be able to attach files from a network share in cases where the command is run from a computer other than the computer that SQL Server runs on.


http://msdn.microsoft.com/en-us/library/ms190307.aspx

Paul



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Peter Gadsby
Peter Gadsby
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 305
Hmmm still don't understand....

I am on a Citrix server, connecting to SQL Server remotely using a local SQLSERVER user.

My NT account has NO permissions to the SQLSERVER box, I can't even login to the server.

When I call the command ....

EXEC msdb..SP_SEND_DBMAIL
@RECIPIENTS= 'XXX@XXX.com',
@PROFILE_NAME = 'MAIL',
@SUBJECT = 'TEST',
@BODY = 'TEST',
@BODY_FORMAT = 'HTML',
@file_attachments = 'C:\New Text Document (2).txt'

The email is successfully sent

I can also send an email using an attachment using a UNC path....


EXEC msdb..SP_SEND_DBMAIL
@RECIPIENTS= 'XXX@XXX.com',
@PROFILE_NAME = 'MAIL',
@SUBJECT = 'TEST',
@BODY = 'TEST',
@BODY_FORMAT = 'HTML',
@file_attachments = '\\comdata01\Shared\orchard.log'

What am I missing?

Peter Gadsby
Business Intelligence Consultant
www.hgconsult.co.uk
Paul White
Paul White
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16330 Visits: 11355
Peter,

Are you able to run:

select net_transport, protocol_type, auth_scheme from sys.dm_exec_connections where session_id = @@spid;
select [host_name], login_name, original_login_name from sys.dm_exec_sessions where session_id = @@spid;



...please?

The results may help explain things.

Paul



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Peter Gadsby
Peter Gadsby
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 305
Nop still don't understand, perhaps I'm having a blonde day!

The output shows....

TCP TSQL SQL

COMWTSV06 DATA_LOAD DATA_LOAD


DATA_LOAD being the local user login....

Listen don't worry, it's working for me I was just trying to help the original poster......

Peter Gadsby
Business Intelligence Consultant
www.hgconsult.co.uk
Paul White
Paul White
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16330 Visits: 11355
I meant the output might help explain it to me! :-D

It didn't. I suppose your SQL Server team might have hacked sp_send_dbmail - the default procedure has an EXECUTE AS 'dbo' on the procedure, but an EXECUTE AS CALLER wrapped around the bit that attaches the file.

I wonder if they have changed that to EXECUTE AS SELF/OWNER/a user mapped to a windows login and removed the EXECUTE AS CALLER bit...? Wouldn't be supported, but it's an interesting idea. I might try it later just to see.

Paul



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Peter Gadsby
Peter Gadsby
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 305
Nothing has changed to the SP they are using the standard one.

Peter Gadsby
Business Intelligence Consultant
www.hgconsult.co.uk
Lisset
Lisset
SSC-Enthusiastic
SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)

Group: General Forum Members
Points: 172 Visits: 341
Paul,
How I can vinculate a SQL Server account to Windows account?

Thanks by your help,
qaiser2001pk
qaiser2001pk
SSC Journeyman
SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)

Group: General Forum Members
Points: 75 Visits: 175
Try to use SA account as a Test
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search