summaryrefslogtreecommitdiff
path: root/ext/standard/php_mail.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/php_mail.h')
-rw-r--r--ext/standard/php_mail.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
index 514b189681..6f7d703312 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.h
@@ -22,9 +22,39 @@
#define PHP_MAIL_H
PHP_FUNCTION(mail);
+PHP_FUNCTION(ezmlm_hash);
+
PHP_MINFO_FUNCTION(mail);
-PHP_FUNCTION(ezmlm_hash);
+PHPAPI zend_string *php_mail_build_headers(zval *headers);
PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd);
+#define PHP_MAIL_BUILD_HEADER_CHECK(target, s, key, val) \
+do { \
+ if (Z_TYPE_P(val) == IS_STRING) { \
+ php_mail_build_headers_elem(&s, key, val); \
+ } else if (Z_TYPE_P(val) == IS_ARRAY) { \
+ if (!strncasecmp(target, ZSTR_VAL(key), ZSTR_LEN(key))) { \
+ php_error_docref(NULL, E_WARNING, "'%s' header must be at most one header. Array is passed for '%s'", target, target); \
+ continue; \
+ } \
+ php_mail_build_headers_elems(&s, key, val); \
+ } else { \
+ php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
+ } \
+} while(0)
+
+
+#define PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val) \
+do { \
+ if (Z_TYPE_P(val) == IS_STRING) { \
+ php_mail_build_headers_elem(&s, key, val); \
+ } else if (Z_TYPE_P(val) == IS_ARRAY) { \
+ php_mail_build_headers_elems(&s, key, val); \
+ } else { \
+ php_error_docref(NULL, E_WARNING, "Extra header element '%s' cannot be other than string or array.", ZSTR_VAL(key)); \
+ } \
+} while(0)
+
+
#endif /* PHP_MAIL_H */