WORD SMTPPutROMString(ROM BYTE* Data) { WORD result = 0; while(*Data) { if(SMTPPut(*Data++)) { result++; } else { Data--; break; } } return result; }
WORD SMTPPutROMArray(ROM BYTE* Data, WORD Len) { WORD result = 0; while(Len--) { if(SMTPPut(*Data++)) { result++; } else { Data--; break; } } return result; }
/***************************************************************************** Function: uint16_t SMTPPutString(char* Data) Description: Writes a string to the SMTP client. Precondition: SMTPBeginUsage returned true on a previous call. Parameters: Data - The data to be written Returns: The number of bytes written. If less than the length of Data, then the TX FIFO became full before all bytes could be written. Remarks: This function should only be called externally when the SMTP client is generating an on-the-fly message. (That is, SMTPSendMail was called with SMTPClient.Body set to NULL.) Internal: SMTPPut must be used instead of TCPPutString because "\r\n." must be transparently replaced by "\r\n..". ***************************************************************************/ uint16_t SMTPPutString(char* Data) { uint16_t result = 0; while(*Data) { if(SMTPPut(*Data++)) { result++; } else { Data--; break; } } return result; }
/***************************************************************************** Function: uint16_t SMTPPutArray(uint8_t* Data, uint16_t Len) Description: Writes a series of bytes to the SMTP client. Precondition: SMTPBeginUsage returned true on a previous call. Parameters: Data - The data to be written Len - How many bytes should be written Returns: The number of bytes written. If less than Len, then the TX FIFO became full before all bytes could be written. Remarks: This function should only be called externally when the SMTP client is generating an on-the-fly message. (That is, SMTPSendMail was called with SMTPClient.Body set to NULL.) Internal: SMTPPut must be used instead of TCPPutArray because "\r\n." must be transparently replaced by "\r\n..". ***************************************************************************/ uint16_t SMTPPutArray(uint8_t* Data, uint16_t Len) { uint16_t result = 0; while(Len--) { if(SMTPPut(*Data++)) { result++; } else { Data--; break; } } return result; }
WORD SMTPPutROMString(ROM BYTE* Data) { WORD result = 0; // Must use SMTPPut() instead of TCPPutArray because of transparancy replacements of "\r\n." with "\r\n.." while(*Data) { if(SMTPPut(*Data++)) { result++; } else { Data--; break; } } return result; }