TReK ANSI-C  5.3.3
All ANSI-C APIs
toolkit_email_device_api_ansi_c.h File Reference

An ANSI C email device API. More...

Functions

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitToolkitEmail (const char *config_pathname, const char *email_account_password)
 Intializes the email and texting library using parameters read from a configuration file.
More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitializeToolkitEmail (const char *smtp_server_address, const char *email_account_username, const char *email_account_password, const char *email_address, const char *email_name, boolean_type verify_cert_authorities, boolean_type generate_curl_debug_messages)
 Intializes the email and texting library using input parameters. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SetCertAuthoritesPathAndFilename (const char *ca_path_and_filename)
 Sets an alternate path and file name for the Certificate Authorities (CA) file referenced by curl if curl has been configured to verify CAs. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddToEmailAddress (const char *to_email_address, const char *to_email_name, const char *to_group_name)
 Adds "to" address information to a list of email addresses and associates the email address with a group name if a group name is included with the function call. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddCcEmailAddress (const char *cc_email_address, const char *cc_email_name, const char *cc_group_name)
 Adds "cc" address information to a list of email addresses and associates the email address with a group name if a group name is included with the function call. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddTextToCellPhoneNumber (const char *text_to_cell_phone_number, const char *text_to_cell_phone_carrier, const char *text_to_group_name)
 Adds "text to" cell phone numbers to a list of cell phone numbers and associates the cell phone numbers with a group name if a group name is included with the function call. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveToEmailAddress (const char *to_email_address, const char *group_name)
 Removes "to" address information from a list of email addresses associated with the email address or group name. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveCcEmailAddress (const char *cc_email_address, const char *group_name)
 Removes "cc" address information from a list of email addresses associated with the email address or group name. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveTextToCellPhoneNumber (const char *text_to_cell_phone_number, const char *group_name)
 Removes "text to" cell phone numbers from a list of cell phone numbers and associated with the cell phone numbers or group name. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailMessageDropbox (const char *dropbox_path, const char *email_address_or_group_name, const char *successful_trans_path)
 Creates an email message dropbox. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailFileDropbox (const char *dropbox_path, const char *email_address_or_group_name, const char *successful_trans_path)
 Creates an email file dropbox. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateATextingDropbox (const char *dropbox_path, const char *cell_phone_number_or_group_name, const char *successful_trans_path)
 Creates a texting dropbox. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StartLoggingTReKMessages (const char *log_file_path, const char *log_filename, boolean_type log_debug_messages)
 Starts logging messages to a file. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StopLoggingTReKMessages ()
 Stops logging messages to a file, closes the log file and renames the log file by concatenating the log file name with a GMT time string. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmail (const char *subject, const char *message, const char *email_address_or_group_name)
 Sends an email to the designated email address or group name of recipients. The maximum length of an email is 65000 characters or bytes. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmailWithFile (const char *subject, const char *message, const char *email_address_or_group_name, const char *file_path, const char *file_name)
 Sends an email message and a file as an email attachment to the designated email address or group name of recipients. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendText (const char *text, const char *cell_phone_number_or_group_name)
 Sends a text to the designated cell_phone_number or group of recipients. The maximum length of a text is 65000 characters or bytes. More...
 
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SaveToolkitEmailConfig (const char *config_pathname)
 Saves the email and texting configuration parameters in a text file. More...
 

Detailed Description

An ANSI C email device API.

Function Documentation

◆ AddCcEmailAddress()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddCcEmailAddress ( const char *  cc_email_address,
const char *  cc_email_name,
const char *  cc_group_name 
)

Adds "cc" address information to a list of email addresses and associates the email address with a group name if a group name is included with the function call.

Parameters
[in]cc_email_addressThe cc email address.
[in]cc_email_nameThe cc name.
[in]cc_group_nameThe group name associated with the address. If no group name has been identified, simply pass an empty string (i.e., "")
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
return_value = AddCcEmailAddress("captkirk@nasa.gov","Capt. Kirk","");
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitToolkitEmail(const char *config_pathname, const char *email_account_password)
Intializes the email and texting library using parameters read from a configuration file.
Definition: toolkit_email_device_api_ansi_c.cpp:72
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddCcEmailAddress(const char *cc_email_address, const char *cc_email_name, const char *cc_group_name)
Adds "cc" address information to a list of email addresses and associates the email address with a gr...
Definition: toolkit_email_device_api_ansi_c.cpp:503
#define SUCCESS
The function completed successfully.
Definition: trek_error.h:8

◆ AddTextToCellPhoneNumber()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddTextToCellPhoneNumber ( const char *  text_to_cell_phone_number,
const char *  text_to_cell_phone_carrier,
const char *  text_to_group_name 
)

Adds "text to" cell phone numbers to a list of cell phone numbers and associates the cell phone numbers with a group name if a group name is included with the function call.

Parameters
[in]text_to_cell_phone_numberThe text to cell phone number.
[in]text_to_cell_phone_carrierThe text to cell phone carrier or carrier gateway domain (e.g., T-MOBILE or tmomail.net, AT&T or mms.att.net, VERIZON...)
[in]text_to_group_nameThe group name associated with the text to cell phone number. If no group name has been identified, simply pass an empty string (i.e., "")
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
return_value = AddTextToCellPhoneNumber("1234567890","AT&T","warning");
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddTextToCellPhoneNumber(const char *text_to_cell_phone_number, const char *text_to_cell_phone_carrier, const char *text_to_group_name)
Adds "text to" cell phone numbers to a list of cell phone numbers and associates the cell phone numbe...
Definition: toolkit_email_device_api_ansi_c.cpp:570
Examples
texting_dropbox_example/main.c, and texting_example/main.c.

◆ AddToEmailAddress()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddToEmailAddress ( const char *  to_email_address,
const char *  to_email_name,
const char *  to_group_name 
)

Adds "to" address information to a list of email addresses and associates the email address with a group name if a group name is included with the function call.

Parameters
[in]to_email_addressThe email address that receives the email.
[in]to_email_nameThe email name that receives the email.
[in]to_group_nameThe group name associated with the address. If no group name has been identified, simply pass an empty string (i.e., "")
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
return_value = AddToEmailAddress("captkirk@nasa.gov","Capt. Kirk","");
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION AddToEmailAddress(const char *to_email_address, const char *to_email_name, const char *to_group_name)
Adds "to" address information to a list of email addresses and associates the email address with a gr...
Definition: toolkit_email_device_api_ansi_c.cpp:436
Examples
email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, and email_file_example/main.c.

◆ CreateAnEmailFileDropbox()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailFileDropbox ( const char *  dropbox_path,
const char *  email_address_or_group_name,
const char *  successful_trans_path 
)

Creates an email file dropbox.

The file, placed in an email file dropbox, is sent as a file attachment of an email to desgnated recipients.. The file name becomes the subject of the email.

Parameters
[in]dropbox_pathThe full path and the dropbox directory.
[in]email_address_or_group_nameThe email address or group name associated with a list of recipients.
[in]successful_trans_pathThe full path and the successful transaction directory.
Returns
SUCCESS
FAIL
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
return_value = CreateAnEmailFileDropbox("D:/email_file_dropbox", "group_name", "email_file_success");
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailFileDropbox(const char *dropbox_path, const char *email_address_or_group_name, const char *successful_trans_path)
Creates an email file dropbox.
Definition: toolkit_email_device_api_ansi_c.cpp:902
Examples
email_file_dropbox_example/main.c.

◆ CreateAnEmailMessageDropbox()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailMessageDropbox ( const char *  dropbox_path,
const char *  email_address_or_group_name,
const char *  successful_trans_path 
)

Creates an email message dropbox.

The content of a file, placed in an email message dropbox, is sent as the message of an email to desgnated recipients. The file name becomes the subject of the email.

Parameters
[in]dropbox_pathThe full path and the dropbox directory.
[in]email_address_or_group_nameThe email address or group name associated with a list of recipients.
[in]successful_trans_pathThe full path and the successful transaction directory.
Returns
SUCCESS
FAIL
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
return_value = CreateAnEmailMessageDropbox("D:/email_message_dropbox", "group_name", "email_message_dropbox_success");
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateAnEmailMessageDropbox(const char *dropbox_path, const char *email_address_or_group_name, const char *successful_trans_path)
Creates an email message dropbox.
Definition: toolkit_email_device_api_ansi_c.cpp:830
Examples
email_dropbox_example/main.c.

◆ CreateATextingDropbox()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateATextingDropbox ( const char *  dropbox_path,
const char *  cell_phone_number_or_group_name,
const char *  successful_trans_path 
)

Creates a texting dropbox.

The content of a file, placed in a texting dropbox, is sent as a text to desgnated recipients.

Parameters
[in]dropbox_pathThe full path and the dropbox directory.
[in]cell_phone_number_or_group_nameThe cell phone number or group name associated with a list of recipients.
[in]successful_trans_pathThe full path and the successful transaction directory.
Returns
SUCCESS
FAIL
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
return_value = CreateATextingDropbox("D:/email_texting_dropbox", "group_name", "email_texting_success");
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION CreateATextingDropbox(const char *dropbox_path, const char *cell_phone_number_or_group_name, const char *successful_trans_path)
Creates a texting dropbox.
Definition: toolkit_email_device_api_ansi_c.cpp:973
Examples
texting_dropbox_example/main.c.

◆ InitializeToolkitEmail()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitializeToolkitEmail ( const char *  smtp_server_address,
const char *  email_account_username,
const char *  email_account_password,
const char *  email_address,
const char *  email_name,
boolean_type  verify_cert_authorities,
boolean_type  generate_curl_debug_messages 
)

Intializes the email and texting library using input parameters.

Parameters
[in]smtp_server_addressEmail SMTP server address (e.g., smtp.gmail.com).
[in]email_account_usernameEmail account username.
[in]email_account_passwordEmail account password.
[in]email_addressEmail address.
[in]email_nameEmail name.
[in]verify_cert_authoritiesSet this boolean_type variable to TRUE_OR_YES to verify certificate of authority.
[in]generate_curl_debug_messagesSet this boolean_type variable to TRUE_OR_YES to generate curl debug messages associated with transferring data with the email server.
Returns
SUCCESS
FAIL
EMAIL_OPEN_FILE_ERROR
EMAIL_FAILED_TO_PROVIDE_EMAIL_ACCOUNT_PASSWORD
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE
DS_LIBRARY_LOAD_ERROR
DS_LIBRARY_ADDRESS_ERROR
DS_THREAD_START_ERROR
DS_THREAD_TIMEOUT
DS_DEVICE_KEY_BUFFER_SIZE_ERROR
DS_NULL_POINTER_ERROR

Example:

int return_value;
char smtp_server_address[50];
char username[50];
char password[50];
char email_address[50];
char name[50];
boolean_type verify_cert_authorities;
boolean_type generate_curl_debug_messages;
strcpy(smtp_server_address,"smtp.gmail.com");
strcpy(username,"mrspock@gmail.comm");
strcpy(password,"livelongandprosper");
strcpy(email_address,"mrspock@gmail.com");
strcpy(name,"Mr. Spock");
verify_cert_authorities = FALSE_OR_NO;
generate_curl_debug_messages = TRUE_OR_YES;
return_value = InitializeToolkitEmail(smtp_server_address,username,password,email_address,name,verify_cert_authorities,generate_curl_debug_messages);
boolean_type
Boolean enumeration.
Definition: ds_shared.h:104
@ FALSE_OR_NO
False.
Definition: ds_shared.h:105
@ TRUE_OR_YES
True.
Definition: ds_shared.h:106
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitializeToolkitEmail(const char *smtp_server_address, const char *email_account_username, const char *email_account_password, const char *email_address, const char *email_name, boolean_type verify_cert_authorities, boolean_type generate_curl_debug_messages)
Intializes the email and texting library using input parameters.
Definition: toolkit_email_device_api_ansi_c.cpp:256
Examples
email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, texting_dropbox_example/main.c, and texting_example/main.c.

◆ InitToolkitEmail()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION InitToolkitEmail ( const char *  config_pathname,
const char *  email_account_password 
)

Intializes the email and texting library using parameters read from a configuration file.

Parameters
[in]config_pathnameThe full path and filename of the Email Device configuration file.
[in]email_account_passwordThe password to the email account. If the password is provided by the configuration file, simply pass an empty string (i.e., "").
Returns
SUCCESS
FAIL
EMAIL_OPEN_FILE_ERROR
EMAIL_FAILED_TO_PROVIDE_EMAIL_ACCOUNT_PASSWORD
EMAIL_INVALID_CONFIG_FILE
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE
DS_LIBRARY_LOAD_ERROR
DS_LIBRARY_ADDRESS_ERROR
DS_THREAD_START_ERROR
DS_THREAD_TIMEOUT
DS_DEVICE_KEY_BUFFER_SIZE_ERROR
DS_NULL_POINTER_ERROR

Example:

int return_value;
return_value = InitToolkitEmail("./toolkit_email_device_config.txt","email_account_password");
Examples
email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, texting_dropbox_example/main.c, and texting_example/main.c.

◆ RemoveCcEmailAddress()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveCcEmailAddress ( const char *  cc_email_address,
const char *  group_name 
)

Removes "cc" address information from a list of email addresses associated with the email address or group name.

Parameters
[in]cc_email_addressThe "cc" email address.
[in]group_nameThe group name.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
if (AddCcEmailAddress("captkirk@nasa.gov","Capt. Kirk","") == SUCCESS)
{
return_value = RemoveCcEmailAddress("captkirk@nasa.gov","");
}
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveCcEmailAddress(const char *cc_email_address, const char *group_name)
Removes "cc" address information from a list of email addresses associated with the email address or ...
Definition: toolkit_email_device_api_ansi_c.cpp:704

◆ RemoveTextToCellPhoneNumber()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveTextToCellPhoneNumber ( const char *  text_to_cell_phone_number,
const char *  group_name 
)

Removes "text to" cell phone numbers from a list of cell phone numbers and associated with the cell phone numbers or group name.

Parameters
[in]text_to_cell_phone_numberThe "text to" cell phone number.
[in]group_nameThe group name.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
if (AddTextToCellPhoneNumber("1234567890","AT&T","warning") == SUCCESS)
{
return_value = RemoveTextToCellPhoneNumber("1234567890","");
}
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveTextToCellPhoneNumber(const char *text_to_cell_phone_number, const char *group_name)
Removes "text to" cell phone numbers from a list of cell phone numbers and associated with the cell p...
Definition: toolkit_email_device_api_ansi_c.cpp:768

◆ RemoveToEmailAddress()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveToEmailAddress ( const char *  to_email_address,
const char *  group_name 
)

Removes "to" address information from a list of email addresses associated with the email address or group name.

Parameters
[in]to_email_addressThe "to" email address.
[in]group_nameThe group name.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
if (AddToEmailAddress("captkirk@nasa.gov","Capt. Kirk","") == SUCCESS)
{
return_value = RemoveToEmailAddress("captkirk@nasa.gov","");
}
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION RemoveToEmailAddress(const char *to_email_address, const char *group_name)
Removes "to" address information from a list of email addresses associated with the email address or ...
Definition: toolkit_email_device_api_ansi_c.cpp:640

◆ SaveToolkitEmailConfig()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SaveToolkitEmailConfig ( const char *  config_pathname)

Saves the email and texting configuration parameters in a text file.

Note: The email account password is not saved in the configuration file. A user must add the password to the "email_account_password" tag in the configuration file if they want to store the password in the configuration file.

Parameters
[in]config_pathnameThe full path and filename of the CFDP configuration file.
Returns
SUCCESS
FAIL
EMAIL_OPEN_FILE_ERROR
EMAIL_WRITE_FILE_ERROR
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
char pathname[50];
char password[50];
char config_pathname[50];
strcpy(pathname,"./email_config.txt");
strcpy(config_pathname,"./new_email_config.txt");
strcpy(password,"password");
if (InitToolkitEmail(pathname, password) == SUCCESS)
{
return_value = SaveToolkitEmailConfig(config_pathname);
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SaveToolkitEmailConfig(const char *config_pathname)
Saves the email and texting configuration parameters in a text file.
Definition: toolkit_email_device_api_ansi_c.cpp:1458
Examples
email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, texting_dropbox_example/main.c, and texting_example/main.c.

◆ SendEmail()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmail ( const char *  subject,
const char *  message,
const char *  email_address_or_group_name 
)

Sends an email to the designated email address or group name of recipients. The maximum length of an email is 65000 characters or bytes.

Parameters
[in]subjectThe subject or title of the email.
[in]messageThe body of the email.
[in]email_address_or_group_nameThe email address or group name associated with a list of recipients.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_MESSAGE_LENGTH_IS_TOO_LONG
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
char pathname[50];
char password[50];
char subject[50];
char message[50];
char group_name[50];
strcpy(pathname,"./toolkit_email_device_config.txt");
strcpy(password,"password");
strcpy(subject,"Example");
strcpy(message,"My example email");
strcpy(group_name,"warning");
if (InitToolkitEmail(pathname,password) == SUCCESS)
{
return_value = SendEmail(subject,message,group_name);
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmail(const char *subject, const char *message, const char *email_address_or_group_name)
Sends an email to the designated email address or group name of recipients. The maximum length of an ...
Definition: toolkit_email_device_api_ansi_c.cpp:1163
Examples
email_example/main.c.

◆ SendEmailWithFile()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmailWithFile ( const char *  subject,
const char *  message,
const char *  email_address_or_group_name,
const char *  file_path,
const char *  filename 
)

Sends an email message and a file as an email attachment to the designated email address or group name of recipients.

Parameters
[in]subjectThe subject or title of the email.
[in]messageThe body of the email.
[in]email_address_or_group_nameThe email address or group name associated with a list of recipients.
[in]file_pathThe full path and the file directory.
[in]filenameThe file name.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_MESSAGE_LENGTH_IS_TOO_LONG
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
char pathname[50];
char password[50];
char subject[50];
char message[50];
char group_name[50];
char file_path[50];
char filename[50];
strcpy(pathname,"./toolkit_email_device_config.txt");
strcpy(password,"password");
strcpy(subject,"Example");
strcpy(message,"My example email");
strcpy(group_name,"warning");
strcpy(file_path,"D:/");
strcpy(filename,"my_file.txt");
if (InitToolkitEmail(pathname,password) == SUCCESS)
{
return_value = SendEmailWithFile(subject,message,group_name,file_path,filename);
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendEmailWithFile(const char *subject, const char *message, const char *email_address_or_group_name, const char *file_path, const char *file_name)
Sends an email message and a file as an email attachment to the designated email address or group nam...
Definition: toolkit_email_device_api_ansi_c.cpp:1264
Examples
email_file_example/main.c.

◆ SendText()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendText ( const char *  text,
const char *  cell_phone_number_or_group_name 
)

Sends a text to the designated cell_phone_number or group of recipients. The maximum length of a text is 65000 characters or bytes.

Parameters
[in]textThe body of the email.
[in]cell_phone_number_or_group_nameThe cell phone number or group name associated with a list of recipients.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
TEXT_MESSAGE_LENGTH_IS_TOO_LONG
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
char pathname[50];
char password[50]
char text[50];
char group_name[50];
strcpy(pathname,"./toolkit_email_device_config.txt");
strcpy(password,"password");
strcpy(text,"My example text");
strcpy(group_name,"warning");
if (InitToolkitEmail(pathname, password) == SUCCESS)
{
return_value = SendText(text,group_name);
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SendText(const char *text, const char *cell_phone_number_or_group_name)
Sends a text to the designated cell_phone_number or group of recipients. The maximum length of a text...
Definition: toolkit_email_device_api_ansi_c.cpp:1368
Examples
texting_example/main.c.

◆ SetCertAuthoritesPathAndFilename()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SetCertAuthoritesPathAndFilename ( const char *  ca_path_and_filename)

Sets an alternate path and file name for the Certificate Authorities (CA) file referenced by curl if curl has been configured to verify CAs.

Curl's default CA file name is "curl-ca-bundle.crt" and default location is the "cert" folder found in the TReK install directory.

Parameters
[in]ca_path_and_filenameCurl's CA path and file name.
Returns
SUCCESS
FAIL
EMAIL_NULL_POINTER_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

int return_value;
if (InitToolkitEmail("./toolkit_email_device_config.txt","password") == SUCCESS)
{
return_value = SetCertAuthoritesPathAndFilename("./curl.crt");
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION SetCertAuthoritesPathAndFilename(const char *ca_path_and_filename)
Sets an alternate path and file name for the Certificate Authorities (CA) file referenced by curl if ...
Definition: toolkit_email_device_api_ansi_c.cpp:377
Examples
email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, and texting_dropbox_example/main.c.

◆ StartLoggingTReKMessages()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StartLoggingTReKMessages ( const char *  log_file_path,
const char *  log_filename,
boolean_type  log_debug_messages 
)

Starts logging messages to a file.

Parameters
[in]log_file_pathThe path of the log file. If an empty string is provided, the default path is the user's home directory.
[in]log_filenameThe base file name of the log file. When logging is stopped, this name will be concatenated with a GMT time string.
[in]log_debug_messagesSet this boolean_type variable to TRUE_OR_YES to log debug messages. The boolean_type is defined in the file "ds_shared.h" as follows:
boolean_type

Value

FALSE_OR_NO

0

TRUE_OR_YES 1
Returns
SUCCESS
DS_FILE_OPEN_ERROR
DS_NULL_POINTER_ERROR
DS_RECORDING_CURRENTLY_ACTIVATED
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

char log_file_path[50];
char log_filename[50];
strcpy(log_file_path,""); // Empty string so use the home directory
// (e.g.,"C:/Users/<username>" or
// "/home/<username>")
strcpy(log_filename,"logger");
// Log only error, warning, info and progress messages
if (StartLoggingTReKMessages(log_file_path,
log_filename,
{
}
int EXPORT_THIS_TOOLKIT_DS_C_FUNCTION DSCleanUp()
Initiates a graceful shutdown of the Device Service library and all supporting device libraries,...
Definition: toolkit_ds_api_ansi_c.cpp:3843
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StartLoggingTReKMessages(const char *log_file_path, const char *log_filename, boolean_type log_debug_messages)
Starts logging messages to a file.
Definition: toolkit_email_device_api_ansi_c.cpp:1069

◆ StopLoggingTReKMessages()

int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StopLoggingTReKMessages ( )

Stops logging messages to a file, closes the log file and renames the log file by concatenating the log file name with a GMT time string.

Returns
SUCCESS
DS_ERROR_RENAMING_LOG_FILE
DS_FILE_CLOSE_ERROR
EMAIL_FAILED_TO_INIT_TOOLKIT_EMAIL_DEVICE

Example:

char log_file_path[50];
char log_file_name[50];
strcpy(log_file_path,""); // Empty string so use the home directory
// (e.g.,"C:/Users/<username>" or
// "/home/<username>")
strcpy(log_file_name,"logger.txt");
if (StartLoggingTReKMessages(log_file_path,
log_file_name,
{
// Log file name concatenated with the GMT time stamp
// (e.g., GMT_2015-01-01_01~01~01~001_logger.txt)
}
int EXPORT_THIS_TOOLKIT_EMAIL_DEVICE_C_FUNCTION StopLoggingTReKMessages()
Stops logging messages to a file, closes the log file and renames the log file by concatenating the l...
Definition: toolkit_email_device_api_ansi_c.cpp:1115