smtpc.h
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
00056
00057 #ifndef MAX_MAIL_RCPTS
00058
00059 #define MAX_MAIL_RCPTS 4
00060 #endif
00061
00065 #define MAIL_RCPT_TYPE 0x03
00066
00067 #define MAIL_RCPT_TO 0x01
00068
00069 #define MAIL_RCPT_CC 0x02
00070
00071 #define MAIL_RCPT_BCC 0x03
00072
00073 #define MAIL_RCPT_ACPT 0x20
00074
00075 #define MAIL_RCPT_SENT 0x40
00076
00077 #define MAIL_RCPT_FAIL 0x80
00078
00079 #define MAIL_RCPT_DONE (MAIL_RCPT_SENT | MAIL_RCPT_FAIL)
00080
00085 typedef struct _MAILENVELOPE {
00087 time_t mail_date;
00089 char *mail_from;
00091 char *mail_subj;
00093 char *mail_body;
00095 char *mail_rcpt[MAX_MAIL_RCPTS];
00097 uint8_t mail_rcpt_stat[MAX_MAIL_RCPTS];
00098 } MAILENVELOPE;
00099
00100 #ifndef SMTP_BUFSIZ
00101
00102 #define SMTP_BUFSIZ 256
00103 #endif
00104
00108 #define SMTPFEAT_VINTAGE 0x00000001
00109
00110 #define SMTPFEAT_AUTH_LOGIN 0x00000002
00111
00112 #define SMTPFEAT_AUTH_PLAIN 0x00000004
00113
00118 typedef struct _SMTPCLIENTSESSION {
00120 TCPSOCKET *smtp_sock;
00122 FILE *smtp_stream;
00124 uint32_t smtp_feat;
00126 char smtp_buff[SMTP_BUFSIZ];
00127 } SMTPCLIENTSESSION;
00128
00131 __BEGIN_DECLS
00132
00133
00134 extern SMTPCLIENTSESSION * NutSmtpConnect(uint32_t ip, uint16_t port);
00135 extern void NutSmtpDisconnect(SMTPCLIENTSESSION *si);
00136 extern int NutSmtpLogin(SMTPCLIENTSESSION *si, char *host, char *user, char *pass);
00137
00138 extern CONST char *NutSmtpSendMail(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00139 extern int NutSmtpSendMailRequest(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00140 extern int NutSmtpSendMailHeader(SMTPCLIENTSESSION *si, MAILENVELOPE *me);
00141 extern int NutSmtpSendEncodedLines(SMTPCLIENTSESSION *si, CONST char *text);
00142
00143 extern CONST char *NutSmtpSendCommand(SMTPCLIENTSESSION *si, CONST char *fmt, ...);
00144 extern CONST char *NutSmtpReceiveResponse(SMTPCLIENTSESSION *si);
00145
00146 __END_DECLS
00147
00148 #endif