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