2000-06-17 02:24:02 +08:00
|
|
|
#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */
|
1999-04-08 05:05:13 +08:00
|
|
|
#define sendmail_h
|
2003-01-03 23:17:43 +08:00
|
|
|
#ifndef NETWARE
|
1999-04-08 05:05:13 +08:00
|
|
|
#include <windows.h>
|
2003-01-03 23:17:43 +08:00
|
|
|
#endif
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
#define HOST_NAME_LEN 256
|
|
|
|
#define MAX_APPNAME_LENGHT 100
|
2002-05-14 21:52:18 +08:00
|
|
|
#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */
|
2000-06-17 02:24:02 +08:00
|
|
|
/* Return values */
|
2002-05-14 21:52:18 +08:00
|
|
|
#define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */
|
|
|
|
#define SUCCESS 0
|
|
|
|
#define FAILED_TO_PARSE_ARGUMENTS 1
|
|
|
|
#define FAILED_TO_OPEN_MAILFILE 2
|
|
|
|
#define FAILED_TO_START_SOCKETS 3
|
|
|
|
#define FAILED_TO_RESOLVE_HOST 4
|
|
|
|
#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
|
|
|
|
#define FAILED_TO_CONNECT 6
|
|
|
|
#define FAILED_TO_SEND 7
|
|
|
|
#define FAILED_TO_RECEIVE 8
|
|
|
|
#define SMTP_SERVER_ERROR 9
|
|
|
|
#define FAILED_TO_GET_HOSTNAME 10
|
|
|
|
#define OUT_OF_MEMORY 11
|
|
|
|
#define UNKNOWN_ERROR 12
|
|
|
|
#define BAD_MSG_CONTENTS 13
|
|
|
|
#define BAD_MSG_SUBJECT 14
|
|
|
|
#define BAD_MSG_DESTINATION 15
|
|
|
|
#define BAD_MSG_RPATH 16
|
|
|
|
#define BAD_MAIL_HOST 17
|
|
|
|
#define BAD_MSG_FILE 18
|
|
|
|
#define W32_SM_SENDMAIL_FROM_NOT_SET 19
|
|
|
|
#define W32_SM_SENDMAIL_FROM_MALFORMED 20
|
2002-06-06 01:08:38 +08:00
|
|
|
#define W32_SM_PCRE_ERROR 21
|
|
|
|
#define MAX_ERROR_INDEX 22 /* Always last error message + 1 */
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
|
2003-12-09 06:10:42 +08:00
|
|
|
PHPAPI int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
|
2002-07-03 06:29:13 +08:00
|
|
|
char *RPath, char *Subject, char *mailTo, char *data,
|
2005-08-08 06:06:29 +08:00
|
|
|
char *mailCc, char *mailBcc, char *mailRPath TSRMLS_DC);
|
2003-12-09 06:10:42 +08:00
|
|
|
PHPAPI void TSMClose(void);
|
2005-08-08 06:06:29 +08:00
|
|
|
static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
|
|
|
|
char *headers, char *headers_lc, char **error_message TSRMLS_DC);
|
2003-12-09 06:10:42 +08:00
|
|
|
PHPAPI char *GetSMErrorText(int index);
|
1999-04-08 05:05:13 +08:00
|
|
|
|
2005-08-08 06:06:29 +08:00
|
|
|
static int MailConnect();
|
|
|
|
static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders TSRMLS_DC);
|
|
|
|
static int Post(LPCSTR msg);
|
|
|
|
static int Ack(char **server_response);
|
|
|
|
static unsigned long GetAddr(LPSTR szHost);
|
2009-08-27 05:59:54 +08:00
|
|
|
static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString);
|
2000-06-17 02:24:02 +08:00
|
|
|
#endif /* sendmail_h */
|