sendmail.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #define HOST_NAME_LEN 256
  7. #define MAX_APPNAME_LENGTH 100
  8. #define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */
  9. /* Return values */
  10. #define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */
  11. #define SUCCESS 0
  12. #define FAILED_TO_PARSE_ARGUMENTS 1
  13. #define FAILED_TO_OPEN_MAILFILE 2
  14. #define FAILED_TO_START_SOCKETS 3
  15. #define FAILED_TO_RESOLVE_HOST 4
  16. #define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
  17. #define FAILED_TO_CONNECT 6
  18. #define FAILED_TO_SEND 7
  19. #define FAILED_TO_RECEIVE 8
  20. #define SMTP_SERVER_ERROR 9
  21. #define FAILED_TO_GET_HOSTNAME 10
  22. #define OUT_OF_MEMORY 11
  23. #define UNKNOWN_ERROR 12
  24. #define BAD_MSG_CONTENTS 13
  25. #define BAD_MSG_SUBJECT 14
  26. #define BAD_MSG_DESTINATION 15
  27. #define BAD_MSG_RPATH 16
  28. #define BAD_MAIL_HOST 17
  29. #define BAD_MSG_FILE 18
  30. #define W32_SM_SENDMAIL_FROM_NOT_SET 19
  31. #define W32_SM_SENDMAIL_FROM_MALFORMED 20
  32. #define W32_SM_PCRE_ERROR 21
  33. #define MAX_ERROR_INDEX 22 /* Always last error message + 1 */
  34. PHPAPI int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
  35. char *RPath, char *Subject, char *mailTo, char *data,
  36. char *mailCc, char *mailBcc, char *mailRPath TSRMLS_DC);
  37. PHPAPI void TSMClose(void);
  38. static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
  39. char *headers, char *headers_lc, char **error_message TSRMLS_DC);
  40. PHPAPI char *GetSMErrorText(int index);
  41. static int MailConnect();
  42. static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders TSRMLS_DC);
  43. static int Post(LPCSTR msg);
  44. static int Ack(char **server_response);
  45. static unsigned long GetAddr(LPSTR szHost);
  46. static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString);
  47. #endif /* sendmail_h */