Go to the source code of this file.
Data Structures | |
struct | smtp_connexion_config |
This structure defines the information used by the SMTP client to connect to the server. More... | |
struct | smtp_mail |
This structure defines the information used by the SMTP client to send an e-mail. More... | |
struct | smtp_res |
This structure defines the information returned by all client SMTP functions. More... | |
struct | smtp_response |
This structure contains the information included in the answer from a SMTP server. More... | |
Defines | |
#define | SMTP_ID_SIZE 1034 |
Maximum number of characters for the client identification (HELO command). | |
#define | SMTP_EMAIL_SIZE_MAX 1024 |
Maximum number of characters for an e-mail address. | |
#define | SMTP_RCPT_MAX 128 |
Maximum number of recipients for a given mail. | |
#define | SMTP_HOSTNAME_SIZE 512 |
Maximum number of characters for a host name. | |
#define | SMTP_WRITE_ERROR -100 |
Return balues for all the SMTP API. This means that the system call write() failed. | |
#define | SMTP_BAD_ANSWER -101 |
Return balues for all the SMTP API. This means that the response from the SMTP server was not valid. | |
#define | SMTP_BUFFER_OVERFLOW -102 |
Return balues for the function smtp_send_email(). This means that one of the input arguments "from" or "rcpt" is too long. | |
#define | SMTP_BUFFER_SIZE 1024 |
Size of the buffer used to receive/send data from/to the SMTP server. | |
#define | SMTP_SERVER_IDENTIFICATION_OK 220 |
Return value for the function response_parser(). The SMTP server returned "220 ...". | |
#define | SMTP_CLIENT_IDENTIFICATION_OK 250 |
Return value for the function response_parser(). The SMTP server returned "250 ...". | |
#define | SMTP_FROM_OK 250 |
Return value for the function response_parser(). The SMTP server returned "250 ...". | |
#define | SMTP_RCPT_OK 250 |
Return value for the function response_parser(). The SMTP server returned "250 ...". | |
#define | SMTP_DATA_OK 354 |
Return value for the function response_parser(). The SMTP server returned "354 ...". | |
#define | SMTP_END_OF_DATA_OK 250 |
Return value for the function response_parser(). The SMTP server returned "250 ...". | |
#define | SMTP_INVALID_ANSWER -1 |
Return value for the function response_parser(). The SMTP server an invalid response. | |
#define | SMTP_FROM_TAG_START "MAIL FROM:<" |
#define | SMTP_FROM_TAG_STOP ">\r\n" |
#define | SMTP_RCPT_TAG_START "RCPT TO:<" |
#define | SMTP_RCPT_TAG_STOP ">\r\n" |
#define | MY_SMTP_HEADER |
Functions | |
int | client_smtp_connect (struct smtp_connexion_config *conf, struct smtp_res *result) |
Open a connexion to the SMTP server. | |
void | smtp_disconnect () |
Close the connexion between the SMTP client ant the server. | |
int | smtp_send_email (struct smtp_connexion_config *conf, struct smtp_mail *email, struct smtp_res *result) |
Send an email to the SMTP server. |
Definition in file my_smtp.h.
|
Open a connexion to the SMTP server.
Definition at line 93 of file smtp.c. References smtp_connexion_config::connect_timeout_micro, smtp_connexion_config::connect_timeout_sec, smtp_res::ellapsed, smtp_res::error_code, smtp_connexion_config::host, smtp_connexion_config::id, open_tcp_connexion(), smtp_connexion_config::port, read_from_socket(), smtp_connexion_config::read_timeout_micro, smtp_connexion_config::read_timeout_sec, response_parser(), SCK_READ_OK, SMTP_BAD_ANSWER, SMTP_BUFFER_SIZE, SMTP_CLIENT_IDENTIFICATION_OK, smtp_disconnect(), SMTP_SERVER_IDENTIFICATION_OK, SMTP_WRITE_ERROR, tcp_add, and tcp_sock. |
|
Send an email to the SMTP server.
If the returned value is -1 (error), then the field error_code of the structure pointed by result contains an error code that describes the failure. This value may be:
Definition at line 257 of file smtp.c. References smtp_mail::data, smtp_res::ellapsed, smtp_res::error_code, smtp_mail::from, smtp_mail::rcpt, smtp_mail::rcpt_number, read_from_socket(), smtp_connexion_config::read_timeout_micro, smtp_connexion_config::read_timeout_sec, response_parser(), SCK_READ_OK, SMTP_BAD_ANSWER, SMTP_BUFFER_OVERFLOW, SMTP_BUFFER_SIZE, SMTP_DATA_OK, smtp_disconnect(), SMTP_END_OF_DATA_OK, SMTP_FROM_OK, SMTP_RCPT_OK, SMTP_WRITE_ERROR, and tcp_sock. |