Go to the documentation of this file.00001 #ifndef PRO_SMTPC_H
00002 #define PRO_SMTPC_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00047 #include <stdio.h>
00048 #include <time.h>
00049
00050 #include <cfg/smtp.h>
00051 #include <sys/socket.h>
00052
00057
00058 #ifndef MAX_MAIL_RCPTS
00059
00060 #define MAX_MAIL_RCPTS 4
00061 #endif
00062
00066 #define MAIL_RCPT_TYPE 0x03
00067
00068 #define MAIL_RCPT_TO 0x01
00069
00070 #define MAIL_RCPT_CC 0x02
00071
00072 #define MAIL_RCPT_BCC 0x03
00073
00074 #define MAIL_RCPT_ACPT 0x20
00075
00076 #define MAIL_RCPT_SENT 0x40
00077
00078 #define MAIL_RCPT_FAIL 0x80
00079
00080 #define MAIL_RCPT_DONE (MAIL_RCPT_SENT | MAIL_RCPT_FAIL)
00081
00086 typedef struct _MAILENVELOPE {
00088 time_t mail_date;
00090 char *mail_from;
00092 char *mail_from_header;
00094 char *mail_subj;
00096 char *mail_body;
00098 char *mail_rcpt[MAX_MAIL_RCPTS];
00100 char *mail_rcpt_header[MAX_MAIL_RCPTS];
00102 uint8_t mail_rcpt_stat[MAX_MAIL_RCPTS];
00103 } MAILENVELOPE;
00104
00105 #ifndef SMTP_BUFSIZ
00106
00107 #define SMTP_BUFSIZ 256
00108 #endif
00109
00113 #define SMTPFEAT_VINTAGE 0x00000001
00114
00115 #define SMTPFEAT_AUTH_LOGIN 0x00000002
00116
00117 #define SMTPFEAT_AUTH_PLAIN 0x00000004
00118
00123 typedef struct _SMTPCLIENTSESSION {
00125 TCPSOCKET *smtp_sock;
00127 FILE *smtp_stream;
00129 uint32_t smtp_feat;
00131 char smtp_buff[SMTP_BUFSIZ];
00132 } SMTPCLIENTSESSION;
00133
00136 __BEGIN_DECLS
00137
00138
00139 extern SMTPCLIENTSESSION * NutSmtpConnect(uint32_t ip, uint16_t port);
00140 extern void NutSmtpDisconnect(SMTPCLIENTSESSION *si);
00141 extern int NutSmtpLogin(SMTPCLIENTSESSION *si, char *host, char *user, char *pass);
00142
00143 extern CONST char *NutSmtpSendMail(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00144 extern int NutSmtpSendMailRequest(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00145 extern int NutSmtpSendMailHeader(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00146 extern int NutSmtpSendEncodedLines(SMTPCLIENTSESSION *si, CONST char *text);
00147
00148 extern CONST char *NutSmtpSendCommand(SMTPCLIENTSESSION *si, CONST char *fmt, ...);
00149 extern CONST char *NutSmtpReceiveResponse(SMTPCLIENTSESSION *si);
00150
00151 __END_DECLS
00152
00153 #endif