Skip to main content
Question

Mail with attachment from SQL msdb doesn't work from TW application via IAM

  • November 4, 2025
  • 1 reply
  • 31 views

Forum|alt.badge.img+13

All,
From our thinkwise application we send email via SQl msdb. This works fine for years, but now I deployed a test application and emails with an attachment will not be sent. It’s a rights issue, the attachment is on another share, so not on the SQL server. If I start the application via the SF it works fine. If I start the application via IAM (not via Indicium so in the ini file RDBMS = SQLSERVER)
an email without attachment is sent, an email with an attachment will not be sent.

I added logging in my send mail script.
EXEC xp_fileexist @FilePath;
Die geeft 0 terug, wat betekent dat de Thinkwise app de bijlage NIET ziet.

De SQL USER function heb ik ook in de logging gezet en die geeft terug: [domain]\srv_indicium
The SUSER_NAME() is diezelfde gebruiker.
En de ORIGINAL_LOGIN() is mijn eigen account.
Zowel mijn eigen account als de srv_indicium hebben rechten op de share waar de bestanden staan.

Als ik in de verkenner het pad met het bestand kopieert onder mijn eigen login, dus dat is ook de login onder welke naam de applicatie wordt gestart, wordt het bestand gewoon geopend en krijg ik een preview te zien in de windows verkenner.

De user waar de SQL instance onder draait heet: srv_sql-02-thinkwise en ook die heeft rechten op de folder. 
Heeft iemand een idee waarom SQL die mail niet wil versturen en hij niet bij de bijlage kan?

 

1 reply

Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • November 24, 2025

Hi Edwin,

Is this a 2-tier environment? As in, Indicium is not the one actually sending the email?

If you are running Windows GUI 2-tier, then the Windows GUI executes the command that send the mail. Or else if this is part of a system flow, then Indicium indeed executes these commands.

When "EXEC xp_fileexist @FilePath;” fails, that could mean the account does not have sysadmin rights: Extended stored procedure xp_fileexist appears to require sysadmin permissions - Microsoft Q&A

Also in this topic: windows - SQL Server xp_fileExist different results depending on login - Stack Overflow

It appears you can use a different command for this:

exec ('SELECT * FROM sys.dm_os_file_exists ('''+@FilePath+''')')

Could this be the problem?

Alternatively, is it an option to switch to a dedicated Email provider such as Microsoft Graph, Mailchimp, Sendgrid or SMTP?