NetBurner 3.5.0
PDF Version
 
mailto.h
Go to the documentation of this file.
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
18#ifndef _NB_MAILTO
19#define _NB_MAILTO
20
21#include <predef.h>
22#include <nettypes.h>
28#define STATUS_OK (0)
29#define CONNECT_TO_SMTP_SERVER_FAILED (-1)
30#define INITIAL_SERVER_REPLY_FAILED (-2)
31#define HELO_SERVER_REPLY_FAILED (-3)
32#define MAIL_FROM_SERVER_REPLY_FAILED (-4)
33#define RCPT_TO_SERVER_REPLY_FAILED (-5)
34#define DATA_SERVER_REPLY_FAILED (-6)
35#define DATA_END_SERVER_REPLY_FAILED (-7)
36#define AUTH_LOGIN_SERVER_REPLY_FAILED (-8)
37#define USER_ID_SERVER_REPLY_FAILED (-9)
38#define PASSWORD_SERVER_REPLY_FAILED (-10)
39#define CONNECT931_SMTP_SERVER_FAILED (-11)
42/*-------------------------------------------------------------------
43 * Send an email
44 * Returns 0 on failure, 1 on success
45 *------------------------------------------------------------------ */
62int SendMail(IPADDR smtp_server, /* IP address of the SMTP server */
63 PCSTR userid, /* ASCII String to provide for RFC931 IDentification */
64 PCSTR from_addr, /* From E-Mail address */
65 PCSTR to_addr, /* To E-Mail Address */
66 PCSTR subject, /* E-Mail subject */
67 PCSTR textbody /* E-Mail body */);
68
69/*-------------------------------------------------------------------
70 * Send an email with plain text authentication
71 * Returns 0 on failure, 1 on success
72 *-------------------------------------------------------------------*/
96int SendMailAuth(IPADDR smtp_server, /*IP address of the SMTP server */
97 PCSTR userid, /* ASCII String to provide for RFC931 IDentification */
98 PCSTR pass, /* ASCII String to provide for AUTH IDentification */
99 PCSTR from_addr, /* From E-Mail address */
100 PCSTR to_addr, /* To E-Mail Address */
101 PCSTR subject, /* E-Mail subject */
102 PCSTR textbody /* E-Mail body */);
103
104/*-------------------------------------------------------------------
105 * Similar to SendMail() with the following additions:
106 * 1. The from_addr_rev_path is used to include the reverse source
107 * route per RFC 821 reverse-path option.
108 * 2. The email contains the memo header. The mail data includes
109 * the memo header items such at DATE, Subject, TO, CC and From.
110 *------------------------------------------------------------------*/
132int SendMailEx(IPADDR smtp_server,
133 PCSTR userid,
134 PCSTR from_addr_rev_path,
135 PCSTR from_addr_memo_hdr,
136 PCSTR to_addr,
137 PCSTR subject,
138 PCSTR textbody);
139
140/*-------------------------------------------------------------------
141 * Send an email as if the NetBurner device was a SMTP server, rather
142 * than the standard way of sending an email through an external
143 * SMTP server through a user account.
144 * ------------------------------------------------------------------*/
145int SendMailAsServer(PCSTR from_addr, PCSTR to_addr, PCSTR subject, PCSTR textbody);
146
147extern uint16_t SMTP_PORT;
148extern uint16_t SMTP_AUTH_PORT;
149extern uint16_t RFC931_PORT;
150extern uint16_t LOCAL_MAIL_PORT;
151
152/*-------------------------------------------------------------------
153 * The following functions, variables and definitions are used for
154 * error reporting of the mail system.
155 * -----------------------------------------------------------------*/
156
157// Returns 0 or error code
167
180void PrintNBError(int fd = 0);
181
195void PrintServerLog(int fd = 0);
196
197// Returns 0 or error code
198extern int NB_Mail_Error_Code;
199
200// Last error string reported by NetBurner mail library. This is usually
201// displayed on the debug serial port.
202extern char NB_Mail_Error_String[];
203
204// Last error string received from mail server
205extern char Server_Mail_Log_String[];
206
259int SendMailAuthStartMIME(IPADDR smtp_server, PCSTR userid, PCSTR pass, PCSTR from_addr, PCSTR to_addr, PCSTR subject, int &fd);
260
278int SendMailAuthAddMIME(int fd, int ContentType, const char *pContent, const char *FileName);
279
293int SendMailAuthEndMIME(int fd, PCSTR userid);
294
295void MIME_SendMultipartHeader(int fd);
296
297#endif
298
299#ifdef _NB_SSL_MAILTO
300/*-------------------------------------------------------------------
301 * Function to look for matching server return codes
302 * ----------------------------------------------------------------*/
303int SMPMatch(int fd, int fd931, PCSTR userid, PCSTR match, uint32_t timeout);
304int writeb64string(int fd, const char *cp);
305void SaveToMailLog(const char *buffer, int rv);
306extern uint16_t Server_String_Count;
307#endif
308
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
int SendMailAuthStartMIME(IPADDR smtp_server, PCSTR userid, PCSTR pass, PCSTR from_addr, PCSTR to_addr, PCSTR subject, int &fd)
Start a Multi-purpose Internet Mail Extension (MIME)session.
int IsMailError()
Returns the error status of the last send mail transaction.
int SendMailEx(IPADDR smtp_server, PCSTR userid, PCSTR from_addr_rev_path, PCSTR from_addr_memo_hdr, PCSTR to_addr, PCSTR subject, PCSTR textbody)
Send an email message function, extended version.
CONTENT_TYPE_ENUM
SMTP MIME Conetnet Types.
Definition mailto.h:213
int SendMail(IPADDR smtp_server, PCSTR userid, PCSTR from_addr, PCSTR to_addr, PCSTR subject, PCSTR textbody)
Send an email message. The function will open a TCP connection to the specified SMTP server,...
int SendMailAuthEndMIME(int fd, PCSTR userid)
Send a MIME email message and close the SMTP session.
int SendMailAuthAddMIME(int fd, int ContentType, const char *pContent, const char *FileName)
Add a MIME part or attachment to an open MIME Session.
void PrintServerLog(int fd=0)
Prints the server log of the last send mail transaction.
void PrintNBError(int fd=0)
If an error occurred, prints the error information received from the SMTP server.
int SendMailAuth(IPADDR smtp_server, PCSTR userid, PCSTR pass, PCSTR from_addr, PCSTR to_addr, PCSTR subject, PCSTR textbody)
Send an email message with plain text authentication. The function will open a TCP connection to the ...
@ CONTENT_TYPE_HTML_DECOMP
HTML.
Definition mailto.h:217
@ CONTENT_TYPE_PLAIN_TEXT_ATTACH
Plain text attachment.
Definition mailto.h:215
@ CONTENT_TYPE_PLAIN_TEXT
Plain text.
Definition mailto.h:214
@ CONTENT_TYPE_BINARY_ATTACH
Binary attachment.
Definition mailto.h:216
@ CONTENT_TYPE_END
Additional content types can be added above this line.
Definition mailto.h:219
NetBurner IPADDR4 Class. See the IPADDR4 Class page for complete documentation.