![]() |
| Home |
|
|
Function xn_smtpThis function sends an email message to an SMTP server.
struct rcpt {
char name[80];
};
typedef struct _attach_file_info {
char * attach_file;
char * attach_type;
} attach_file_info;
typedef struct _smtp_info {
BYTE smtp_server_ip[4];
char reverse_path[200];
char user_name[100];
char password[100];
char from[100];
char subject[100];
struct rcpt rcpts[5];
int num_rcpts;
int num_cc;
char * mime_fields;
char * body;
char * body_file;
char * attach;
int attach_len;
attach_file_info * at;
int num_attach_files;
} smtp_info;
int xn_smtp(smtp_info * info);
ParametersinfoPointer to a structure containing information about the email. See below or details. return valueReturns 0 if successful, otherwise SOCKET_ERROR. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. Possible values for this function are:
This function sends an email message using the SMTP protocol. Any number of attachments can be sent. Any attachment not having MIME type "text/plain" will automatically be base64 encoded. The message and possible attachment(s) can either be supplied as string constants or as files. If the message body is supplied as a file or it has attachments, vf_init must be called before this function. The various fields of structure smtp_info have the following meaning:
The fields of structure attach_file_info have the following meaning:
Example MailDemo shows how messages can be sent using this function.
|