[SOLVED] SMTP attachments not completed
Hi there, We have a problem with a GPRS connection to enable our device to send mails to our client so he is able to verify the operation of the unit. We have found a nice SMTP class that enables us to send mail and add attachments. All seems to work great and we send out the units into the field. We have a unit on a location where the GPRS connection is crap. Half of the time the connection is lost. The unit still tries to send the mail via SMTP. The client receives messages, but the attachment is not readable and when compared to the original is corrupt.
The code that creates the mail:
- {
- bool bFileOpen(false);
- qDebug() << qsFileName;
- if (qfFile.open(QIODevice::ReadWrite) == true) // ReadWrite use because we want only write the mail if the file is not already opend.
- { // And we kan only write if the file is not already opend
- qfFile.close();
- stHeader += "Content-disposition: attachment\r\n";
- // Header Prepare
- // Content-Type
- message.append("Content-Type: ").append(stType);
- message.append("; name=\"").append(stName).append("\"");
- message.append("\r\n");
- message.append("Content-Transfer-Encoding: ");
- message.append("base64\r\n");
- message.append(stHeader).append("\r\n");
- // End of Header Prepare
- // Content Encoding
- message.append(content.toBase64());
- message.append("\r\n");
- // End of Content Encoding
- bFileOpen = true;
- }
- qDebug() << "File Open: " << bFileOpen;
- return bFileOpen;
- }
Is there a way to modify this code or the header generation so that the receiving SMTP server will drop the message when not received?
Is there a SMTP protocol command to drop the message if incomplete so our client doesn’t get corrupted data?
Thank already!
1 reply
You must log in to post a reply. Not a member yet? Register here!
