TCPIP_SMTPC_MAIL_MESSAGE Structure
C
typedef struct {
const char* from;
const char* to;
const char* sender;
const char* cc;
const char* bcc;
const char* date;
const char* subject;
const uint8_t* body;
size_t bodySize;
int nBuffers;
const TCPIP_SMTPC_ATTACH_BUFFER* attachBuffers;
int nFiles;
const TCPIP_SMTPC_ATTACH_FILE* attachFiles;
const char* username;
const char* password;
const char* smtpServer;
uint16_t serverPort;
TCPIP_SMTPC_MAIL_FLAGS messageFlags;
TCPIP_SMTPC_MESSAGE_CALLBACK messageCallback;
TCPIP_SMTPC_SERVER_REPLY_CALLBACK replyCallback;
} TCPIP_SMTPC_MAIL_MESSAGE;
Description
Structure: TCPIP_SMTPC_MAIL_MESSAGE.
This data structure describes a mail message.
Members
Members | Description |
---|---|
from | Mandatory Mail Fields |
recipient return address. | |
to | Destination address. |
sender | Optional Mail Fields, if sent on behalf of someone else. |
cc | Carbon copy destination address. |
bcc | Blind carbon copy destination address. |
date | Date for the mail message Should be formatted like: "Wed, 20 July 2016 14:55:06 -0600". If NULL, then the TCPIP_SMTPC_CLIENT_MESSAGE_DATE will be used. |
subject | Regular Mail Fields mail subject line. |
nBuffers | Mail Attachments number of attached buffers |
attachBuffers | Array of buffer attachments. |
nFiles | Number of attached files. |
attachFiles | Array of file attachments. |
username | Mail Authentication: username to be presented when the mail server requires authentication. |
password | Associated password to be presented when the mail server requires authentication. |
smtpServer | Mail Server: address or name of a server to send the mail to (smtp.gmail.com, 74.125.23.109, etc.). |
serverPort | Port on which the SMTP server listens on. Standard SMTP ports are 25 or 587 For servers supporting TLS (gmail, yahoo, etc.), the recommended port is 587. |
messageFlags | Additional message flags. |
messageCallback | Mail Notifications: message completion notification could be NULL if not needed. |
replyCallback | Server reply notification could be NULL if not needed. |
Remarks
SMTPC does NOT make private copies of the strings, buffers, etc. presented in a TCPIP_SMTPC_MAIL_MESSAGE data structure. All fields that are pointers to strings, buffers, files names, etc. MUST be persistent until the mail complete notification is received.
The TCPIP_SMTPC_MAIL_MESSAGE data structure itself does not need to be persistent.
The mail body is not a char* but uint8_t* to allow sending binary data as well as part of the mail body. This requires though that the bodySize member is present.
If some file could not be opened when the mail is sent a warning will be issued and the file will be ignored.
Currently the fields: "sender", "cc" and "bcc" are not used. They will be eventually added.