void SMTPClientConnection::_StartSendFile(const String &sFilename) { if (!_currentFile.Open(sFilename, File::OTReadOnly)) { String sErrorMsg; sErrorMsg.Format(_T("Could not send file %s via socket since it does not exist."), sFilename); ErrorManager::Instance()->ReportError(ErrorManager::High, 5019, "SMTPClientConnection::_SendFileContents", sErrorMsg); return; } _transmissionBuffer.Initialize(this); shared_ptr<ByteBuffer> pBuf = _currentFile.ReadChunk(GetBufferSize()); if (!pBuf) return; BYTE *pSendBuffer = (BYTE*) pBuf->GetBuffer(); int iSendBufferSize = pBuf->GetSize(); // Append the transmission buffer _transmissionBuffer.Append(pSendBuffer, iSendBufferSize); _ReadAndSend(); }
void SMTPClientConnection::OnDataSent() { // Are we currently sending a file to the client? if (!_currentFile.IsOpen()) return; _ReadAndSend(); }