'Failed to open loopback connection'. unable to send send attachments from dbmail

Hi ,

I am unable send attachemts from dataserver but without attachment can send mails.The problem arises only when there is an attachment. Same works fine in all the other servers with same configuration including the dbmail config.I am able access the same path with XP_CMDShell dir command.Any help would be greatly appreciated.

sql server error:

\Shared\softusers\Gautham\att.txt Msg 22051, Level 16, State 1, Line 0 Failed to open loopback connection. Please see event log for more information.

Event Log:

The description for Event ID ( 17052 ) in Source ( MSSQLSERVER ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Severity: 16 Error:18456, OS: 18456 [Microsoft][SQL Native Client][SQL Server]Login failed for user ‘ABC-SQL\sqlaccount’..

Any help would be greatly appreciated.

Thanks in Advance.

Regards, Gautham

more ▼

asked Dec 16, 2009 at 04:58 AM in Default

gautham gravatar image

11 1 1 1

(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first


It seems to me that the user ‘ABC-SQL\sqlaccount’ has not permission to the Shared where attachment is.

Configure DataBase Mail settings log to Verbose to see mor information about the error.

In the Books Online, in the sp_send_dbmail remarks, I found this, I hope its helps:

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.

more ▼

answered Jan 31, 2010 at 03:09 PM

JD gravatar image

104 6 7 8

(comments are locked)
10|1200 characters needed characters left

Part 1: Can you show the code? Presumably you're calling sp_send_dbmail, in which case the attachment file name must be an absolute path.

Part2: An absolute path just means the whole path and file name, not just a relative path (like 'att.txt'). There's no default path that it starts with. A UNC path like you've used is fine as long as Shared is the machine name. If it's the name of the folder, you need the machine name at the front.

There are a few possibilities:

There could be something wrong with the profile you're using. Before you look into more complicated stuff, try sending a test message. In SSMS, right click on Management | Database Mail, and select Send Test E-Mail.

According to this forum post it could be that the attachment is too big or that Oracle could be causing problems.

Attachment size is limited to 1,000,000 bytes (about 1MB) by default. To increase it: in SSMS, right click on Management | Database Mail, select Configure Database Mail, choose View or change system parameters, and alter the Maximum File Size (Bytes).

more ▼

answered Dec 16, 2009 at 05:33 AM

David Wimbush gravatar image

David Wimbush
5.1k 29 31 34

EXEC msdb.dbo.sp_send_dbmail @profile_name = 'myprofile', @recipients = 'dba@xxx.com', @subject = ' Error Listing. ', @body = 'Error Listing. ', @file_attachments ='\Shared\softusers\Gautham\att.txt

Could be you pls be clear on what is absolute path.

Thanks, Gautham
Dec 17, 2009 at 11:03 PM gautham
size of the file is around 10 kb and also i can able to send test mail .
Dec 24, 2009 at 03:24 AM gautham
(comments are locked)
10|1200 characters needed characters left

Some questions...

Are the attachments held in a share?
Does the user ‘ABC-SQL\sqlaccount’ have permissions to the share?
Does the user ‘ABC-SQL\sqlaccount’ have permissions to the filesystem where the attachments are?
Does the user ‘ABC-SQL\sqlaccount’ have the right to connect to the server over the network?
Has a loopback address/adapter been defined on the server?

more ▼

answered Dec 16, 2009 at 10:21 AM

Blackhawk-17 gravatar image

11.9k 28 31 37

yes but i have to check loopback address/adapter been defined on the server has been defined
Dec 17, 2009 at 11:04 PM gautham
(comments are locked)
10|1200 characters needed characters left

Step 1 : Make sure that you have sufficient permission on your shared location .

Step 2 : if your shared location on database server try to test this code by specifying the actual drive name instead of shared location. if that is in the other server it may be a double hoop problem. please provide me more details on the shared location.

more ▼

answered Jan 29, 2010 at 08:54 AM

subramanian gravatar image


(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Dec 16, 2009 at 04:58 AM

Seen: 4685 times

Last Updated: Dec 16, 2009 at 04:58 AM