[Asterisk-Dev] PATCH: voicemail2 for simple MTAs

Jean-Denis Girard jd-girard at esoft.pf
Tue Aug 26 17:34:38 MST 2003


Hi list,

Attached is a trivial patch to app_voicemail2 to allow sending email 
with simple MTAs like esmtp or smtpclient.

-- 
Jean-Denis Girard

====================================================
Essential Software - Ingénierie Informatique
Solutions Linux & Open Source en Polynésie française
----------------------------------------------------
http://www.esoft.pf/
Tél: (689) 54 12 95
====================================================

-------------- next part --------------
--- apps/app_voicemail2.c.ORIG	2003-08-26 13:40:58.000000000 -1000
+++ apps/app_voicemail2.c	2003-08-26 14:19:46.000000000 -1000
@@ -47,7 +47,7 @@
 #define VOICEMAIL_CONFIG "voicemail.conf"
 #define ASTERISK_USERNAME "asterisk"
 
-#define SENDMAIL "/usr/sbin/sendmail -t"
+#define SENDMAIL "/usr/sbin/sendmail"
 
 #define INTRO "vm-intro"
 
@@ -575,6 +575,7 @@
 static int sendmail(char *srcemail, char *email, char *name, int msgnum, char *mailbox, char *callerid, char *attach, char *format, long duration, int attach_user_voicemail)
 {
 	FILE *p;
+	char cmd[512];
 	char date[256];
 	char host[256];
 	char who[256];
@@ -586,7 +587,8 @@
 	if (!strcmp(format, "wav49"))
 		format = "WAV";
 	ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, attach_voicemail);
-	p = popen(SENDMAIL, "w");
+	snprintf(cmd, sizeof(cmd), "%s %s", SENDMAIL, email);
+	p = popen(cmd, "w");
 	if (p) {
 		gethostname(host, sizeof(host));
 		if (strchr(srcemail, '@'))
@@ -677,13 +679,16 @@
 static int sendpage(char *srcemail, char *pager, int msgnum, char *mailbox, char *callerid, long duration)
 {
 	FILE *p;
+	char cmd[512];
 	char date[256];
 	char host[256];
 	char who[256];
 	char dur[256];
 	time_t t;
 	struct tm tm;
-	p = popen(SENDMAIL, "w");
+
+	snprintf(cmd, sizeof(cmd), "%s %s", SENDMAIL, pager);
+	p = popen(cmd, "w");
 
 	if (p) {
 		gethostname(host, sizeof(host));


More information about the asterisk-dev mailing list