php_mail.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_MAIL_H
  19. #define PHP_MAIL_H
  20. PHP_FUNCTION(mail);
  21. PHP_FUNCTION(ezmlm_hash);
  22. PHP_MINFO_FUNCTION(mail);
  23. PHPAPI zend_string *php_mail_build_headers(zval *headers);
  24. PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd);
  25. #define PHP_MAIL_BUILD_HEADER_CHECK(target, s, key, val) \
  26. do { \
  27. if (Z_TYPE_P(val) == IS_STRING) { \
  28. php_mail_build_headers_elem(&s, key, val); \
  29. } else if (Z_TYPE_P(val) == IS_ARRAY) { \
  30. if (!strncasecmp(target, ZSTR_VAL(key), ZSTR_LEN(key))) { \
  31. php_error_docref(NULL, E_WARNING, "'%s' header must be at most one header. Array is passed for '%s'", target, target); \
  32. continue; \
  33. } \
  34. php_mail_build_headers_elems(&s, key, val); \
  35. } else { \
  36. php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
  37. } \
  38. } while(0)
  39. #define PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val) \
  40. do { \
  41. if (Z_TYPE_P(val) == IS_STRING) { \
  42. php_mail_build_headers_elem(&s, key, val); \
  43. } else if (Z_TYPE_P(val) == IS_ARRAY) { \
  44. php_mail_build_headers_elems(&s, key, val); \
  45. } else { \
  46. php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
  47. } \
  48. } while(0)
  49. #endif /* PHP_MAIL_H */