editing qmail-smtpd.c to my needs
Hi. I am relatively new to C++, and I am trying to edit the "qmail-smtpd.c" code modifed to log all incoming mail (sender and recipient) either by executing a system command or logging to a log file itself.
I have tried to do this, but no avail.
I found a place here:
stralloc mailfrom = {0};
stralloc rcptto = {0};
void smtp_mail(arg) char *arg;
{
if (!addrparse(arg)) { err_syntax(); return; }
flagbarf = bmfcheck();
seenmail = 1;
if (!stralloc_copys(&rcptto,"")) die_nomem();
if (!stralloc_copys(&mailfrom,addr.s)) die_nomem();
if (!stralloc_0(&mailfrom)) die_nomem();
/* my hack to execute system to grab sender, and recipient */
system("/bin/echo 'mailfrom -> rcptto' > /tmp/sent.log");
out("250 ok\r\n");
}
but I am unable to print the actual variables mailfrom and rcptto. How do you grab the variables and print them either to file or to Unix system command?
|