提交 80542e20 authored 作者: Brian West's avatar Brian West

FS-5142 don't multipart/mixed if body has content-type present

上级 034bd1bf
......@@ -808,12 +808,19 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
goto end;
}
}
if (!file && (!body || !switch_stristr("content-type", body))) {
bound = NULL;
}
if (bound) {
switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
if (!write_buf(fd, buf)) {
rval = SWITCH_FALSE;
err = "write error.";
goto end;
}
}
if (headers && !write_buf(fd, headers)) {
rval = SWITCH_FALSE;
......@@ -827,6 +834,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
goto end;
}
if (bound) {
if (body && switch_stristr("content-type", body)) {
switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
} else {
......@@ -837,6 +845,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
err = "write error.";
goto end;
}
}
if (body) {
if (!write_buf(fd, body)) {
......@@ -846,7 +855,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
}
}
if (file) {
if (file && bound) {
const char *stipped_file = switch_cut_path(file);
const char *new_type;
char *ext;
......@@ -904,6 +913,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
}
if (bound) {
switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
if (!write_buf(fd, buf)) {
......@@ -912,6 +922,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
goto end;
}
}
}
if (fd > -1) {
close(fd);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论