If I correctly understand the way it works (applications save the emails to SQL then another application takes them out and sends them) you have two choices:
- Save the attachment as binary in the SQL and have the mailer application do the rest.
- Use sockets to transfer the file to the SQL server and save the path to it just as you said.
I'd say option 1 would be the best option if I understood correctly the way its currently working. And as for option 2, there are probably other ways to transfer the file but sockets would be the easily cross-platform option.
Its not hard to get started with sockets, there are a lot of examples all over the internet.