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

MembersDescription
fromMandatory Mail Fields
recipient return address.
toDestination address.
senderOptional Mail Fields, if sent on behalf of someone else.
ccCarbon copy destination address.
bccBlind carbon copy destination address.
dateDate 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.
subjectRegular Mail Fields mail subject line.
nBuffersMail Attachments number of attached buffers
attachBuffersArray of buffer attachments.
nFilesNumber of attached files.
attachFilesArray of file attachments.
usernameMail Authentication: username to be presented when the mail server requires authentication.
passwordAssociated password to be presented when the mail server requires authentication.
smtpServerMail Server: address or name of a server to send the mail to (smtp.gmail.com, 74.125.23.109, etc.).
serverPortPort 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.
messageFlagsAdditional message flags.
messageCallbackMail Notifications: message completion notification could be NULL if not needed.
replyCallbackServer 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.