From 23aa165dffbbfcd7e7072ab620c9fea30dd0780e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 5 Nov 2007 18:45:26 +0000 Subject: [PATCH] make mailer app name a config option git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6163 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- conf/switch.conf.xml | 2 ++ src/include/private/switch_core_pvt.h | 2 ++ src/switch_core.c | 6 ++++++ src/switch_utils.c | 3 ++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/conf/switch.conf.xml b/conf/switch.conf.xml index 98c49f426f..f30ac7cb83 100644 --- a/conf/switch.conf.xml +++ b/conf/switch.conf.xml @@ -8,6 +8,8 @@ + + diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index af75dc9d31..184dedb346 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -171,6 +171,8 @@ struct switch_runtime { int32_t sps; int32_t sps_last; switch_log_level_t hard_log_level; + char *mailer_app; + char *mailer_app_args; }; extern struct switch_runtime runtime; diff --git a/src/switch_core.c b/src/switch_core.c index 25b96547d5..122d9e16db 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -542,6 +542,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS); runtime.hard_log_level = SWITCH_LOG_DEBUG; + runtime.mailer_app = "sendmail"; + runtime.mailer_app_args = "-t"; /* INIT APR and Create the pool context */ if (apr_initialize() != SWITCH_STATUS_SUCCESS) { @@ -595,6 +597,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor switch_core_session_ctl(SCSC_LOGLEVEL, &level); + } else if (!strcasecmp(var, "mailer-app")) { + runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val); + } else if (!strcasecmp(var, "mailer-app-args")) { + runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "sessions-per-second")) { switch_core_sessions_per_second(atoi(val)); } else if (!strcasecmp(var, "max-sessions")) { diff --git a/src/switch_utils.c b/src/switch_utils.c index 0d250828a5..816cd731db 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -33,6 +33,7 @@ #ifndef WIN32 #include #endif +#include "private/switch_core_pvt.h" static const char switch_b64_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define B64BUFFLEN 1024 @@ -179,7 +180,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(char *to, char *from, char *he if (ifd) { close(ifd); } - snprintf(buf, B64BUFFLEN, "/bin/cat %s | /usr/sbin/sendmail -tf \"%s\" %s", filename, from, to); + snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s", filename, runtime.mailer_app, runtime.mailer_app_args); if(system(buf)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf); }