Question

I am working on an application that, among other applications, allows users to send emails. It works by writing everything onto an SQL server, so you can have multiple instances of an application.

The email sending currently works with an "Outbox" table on the SQL server, to which application instances directly write the data with SQL statements. I have, however, hit an issue, that a requirement for attachments on the emails has arisen.

My thinking is that if I can send the attached files to a directory on which the SQL server resides (possibly the TEMP directory?), and then store the path to that file (or a UUID, if the file is constant) in the table. The issue is I have no idea particularly where to start with sending the file, as I am still vaguely new to C++.

One term I have come across is sending it with sockets, but am struggling with where to start with it and do not know if it is indeed the best option. Could anyone provide some advice on this matter?

Thanks in advance.

Was it helpful?

Solution

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:

  1. Save the attachment as binary in the SQL and have the mailer application do the rest.
  2. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top