smf_email_address.h File Reference

Defines the SMFEmailAddress_T data type and functions for E-Mail address handling. More...

#include <cmime.h>
#include "smf_lookup.h"
Include dependency graph for smf_email_address.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef CMimeAddress_T SMFEmailAddress_T
 Represents an E-Mail address.
 

Enumerations

enum  SMFEmailAddressType_T { SMF_EMAIL_ADDRESS_TYPE_TO, SMF_EMAIL_ADDRESS_TYPE_CC, SMF_EMAIL_ADDRESS_TYPE_BCC, SMF_EMAIL_ADDRESS_TYPE_FROM }
 Possible types of email addresses. More...
 

Functions

SMFEmailAddress_Tsmf_email_address_new (void)
 Creates a new SMFEmailAddress_T object.
 
void smf_email_address_free (SMFEmailAddress_T *ea)
 Free a SMFEmailAddress_T object.
 
SMFEmailAddress_Tsmf_email_address_parse_string (const char *addr)
 Parse given string and create SMFEmailAddress_T object.
 
char * smf_email_address_to_string (SMFEmailAddress_T *ea)
 Allocates a string containing the contents of the SMFEmailAddress_T object.
 
void smf_email_address_set_type (SMFEmailAddress_T *ea, SMFEmailAddressType_T t)
 Set the address type of SMFEmailAddress_T object.
 
SMFEmailAddressType_T smf_email_address_get_type (SMFEmailAddress_T *ea)
 Get the address type of SMFEmailAddress_T object.
 
void smf_email_address_set_name (SMFEmailAddress_T *ea, const char *name)
 Set the display name of SMFEmailAddress_T object.
 
char * smf_email_address_get_name (SMFEmailAddress_T *ea)
 Get the display name of a SMFEmailAddress_T object.
 
void smf_email_address_set_email (SMFEmailAddress_T *ea, const char *email)
 Set the email address of SMFEmailAddress_T object.
 
char * smf_email_address_get_email (SMFEmailAddress_T *ea)
 Get the email address of a SMFEmailAddress_T object.
 
int smf_email_address_is_empty (SMFEmailAddress_T *ea)
 Tests whether the email-part is empty.
 
SMFEmailAddress_Tsmf_email_address_get_simplified (SMFEmailAddress_T *ea)
 Creates a simplified address-instance.
 

Detailed Description

Defines the SMFEmailAddress_T data type and functions for E-Mail address handling.

A SMFEmailAddress_T consists of three parts:

To create a new SMFEmailAddress_T, use smf_email_address_new()

To destroy a SMFEmailAddress_T use smf_email_address_free()

It's possible to parse a string with smf_email_address_parse_string() and create a new SMFEmailAddress_T. To get a string from a SMFEmailAddress_T, use smf_email_address_to_string().

Enumeration Type Documentation

Possible types of email addresses.

Enumerator
SMF_EMAIL_ADDRESS_TYPE_TO 

message recipient

SMF_EMAIL_ADDRESS_TYPE_CC 

message cc recipient

SMF_EMAIL_ADDRESS_TYPE_BCC 

nessage bcc recipient

SMF_EMAIL_ADDRESS_TYPE_FROM 

message sender

Function Documentation

void smf_email_address_free ( SMFEmailAddress_T ea)

Free a SMFEmailAddress_T object.

Parameters
eaa SMFEmailAddress_T object
char* smf_email_address_get_email ( SMFEmailAddress_T ea)

Get the email address of a SMFEmailAddress_T object.

Parameters
eaa SMFEmailAddress_T object
Returns
the email address of a SMFEmailAddress_T object
char* smf_email_address_get_name ( SMFEmailAddress_T ea)

Get the display name of a SMFEmailAddress_T object.

Parameters
eaa SMFEmailAddress_T object
Returns
the display name of a SMFEmailAddress_T object
SMFEmailAddress_T* smf_email_address_get_simplified ( SMFEmailAddress_T ea)

Creates a simplified address-instance.

The function can be used to extract the email from the angle-addr format.

Parameters
eaThe SMFEmailAddress_T-instance to clone
Returns
The simplified version of ea
SMFEmailAddressType_T smf_email_address_get_type ( SMFEmailAddress_T ea)

Get the address type of SMFEmailAddress_T object.

Parameters
eaSMFEmailAddress_T object
Returns
a SMFEmailAddressType_T object
int smf_email_address_is_empty ( SMFEmailAddress_T ea)

Tests whether the email-part is empty.

The function pays attention to the angle-addr format.

Parameters
eaThe email-instance to check
Returns
When the email-address is emty true is returned
SMFEmailAddress_T* smf_email_address_new ( void  )

Creates a new SMFEmailAddress_T object.

Returns
an empty SMFEmailAddress_T object
SMFEmailAddress_T* smf_email_address_parse_string ( const char *  addr)

Parse given string and create SMFEmailAddress_T object.

Parameters
addrE-Mail address
Returns
a newly allocated SMFEmailAddress_T object, or NULL on failure
void smf_email_address_set_email ( SMFEmailAddress_T ea,
const char *  email 
)

Set the email address of SMFEmailAddress_T object.

Parameters
eaSMFEmailAddress_T pointer
emailemail address
void smf_email_address_set_name ( SMFEmailAddress_T ea,
const char *  name 
)

Set the display name of SMFEmailAddress_T object.

Parameters
eaSMFEmailAddress_T pointer
namethe display name for the address
void smf_email_address_set_type ( SMFEmailAddress_T ea,
SMFEmailAddressType_T  t 
)

Set the address type of SMFEmailAddress_T object.

Parameters
eaSMFEmailAddress_T object
tSMFEmailAddressType_T type
char* smf_email_address_to_string ( SMFEmailAddress_T ea)

Allocates a string containing the contents of the SMFEmailAddress_T object.

Parameters
eaSMFEmailAddress_T object
Returns
the SMFEmailAddress_T object as an newly allocated string in rfc822 format.