xref: /PHP-5.3/win32/sendmail.h (revision 5d017c3e)
1 #if !defined(sendmail_h)		/* Sentry, use file only if it's not already included. */
2 #define sendmail_h
3 #ifndef NETWARE
4 #include <windows.h>
5 #endif
6 
7 #define HOST_NAME_LEN	256
8 #define MAX_APPNAME_LENGHT 100
9 #define MAIL_BUFFER_SIZE		(1024*4)	/* 4k buffer */
10 /* Return values */
11 #define MIN_ERROR_INDEX					0 /* Always 0 like SUCCESS */
12 #define SUCCESS							0
13 #define FAILED_TO_PARSE_ARGUMENTS		1
14 #define FAILED_TO_OPEN_MAILFILE			2
15 #define FAILED_TO_START_SOCKETS			3
16 #define FAILED_TO_RESOLVE_HOST			4
17 #define FAILED_TO_OBTAIN_SOCKET_HANDLE	5
18 #define FAILED_TO_CONNECT				6
19 #define FAILED_TO_SEND					7
20 #define FAILED_TO_RECEIVE				8
21 #define SMTP_SERVER_ERROR				9
22 #define FAILED_TO_GET_HOSTNAME			10
23 #define OUT_OF_MEMORY					11
24 #define UNKNOWN_ERROR					12
25 #define BAD_MSG_CONTENTS				13
26 #define BAD_MSG_SUBJECT					14
27 #define BAD_MSG_DESTINATION				15
28 #define BAD_MSG_RPATH					16
29 #define BAD_MAIL_HOST					17
30 #define BAD_MSG_FILE					18
31 #define W32_SM_SENDMAIL_FROM_NOT_SET	19
32 #define W32_SM_SENDMAIL_FROM_MALFORMED	20
33 #define W32_SM_PCRE_ERROR				21
34 #define MAX_ERROR_INDEX					22 /* Always last error message + 1 */
35 
36 
37 PHPAPI int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
38 			  char *RPath, char *Subject, char *mailTo, char *data,
39 			  char *mailCc, char *mailBcc, char *mailRPath TSRMLS_DC);
40 PHPAPI void TSMClose(void);
41 static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
42 			 char *headers, char *headers_lc, char **error_message TSRMLS_DC);
43 PHPAPI char *GetSMErrorText(int index);
44 
45 static int MailConnect();
46 static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders TSRMLS_DC);
47 static int Post(LPCSTR msg);
48 static int Ack(char **server_response);
49 static unsigned long GetAddr(LPSTR szHost);
50 static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString);
51 #endif							/* sendmail_h */
52