Re: first stab at simple mailer

From:

Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>

Date:

Wed, 21 Mar 2007 09:32:07 -0700 (PDT)

* Do not embed newlines in strings. Just use string concactenation:
"abcd\n"
"efgh\n"
"..."
^^ this is treated as a single string in C
* Background the process using the daemon(3) function
* Wrap calloc, malloc, strdup, etc.
* I didn't quite undersand what the link() business was about. When
processing queues, it is best to avoid all unnecessary namespace
manipulation (rename, link primarily).
* Remote delivery, which you have as 'XXX implement me'... you need
to be able to sort by the target domain's MX lookup and you need to
do MX backoff & forwarding for any remote delivery. It isn't too
bad but DNS lookups can be difficult to implement efficiently.
* Configuration file. Yup. you need one :-).
How serious are you about this? There are a number of issues that
would have to be addressed, even for a simple mailer. Handoffs for
.forward files (including processing exit codes properly), supporting
/etc/mail/aliases and /etc/mail/virtusertable, and handling a more
sophisticated local delivery check (using a DNS lookup on the target
domain to see if its a CNAME to the actual host, or something similar)....
all are absolutely required.
There are many other issues as well, including mail size limitations,
smarter queueing mechanisms (sorting by target recipient to prevent a
stalled target host from stalling the entire queue), handling
out-of-disk-space issues gracefully, etc.
If you intend to build the daemon side as well then there are many
other issues as well including limiting the memory used to hold headers,
proper string parsing, hand-off security, MIME issues, and other things.
please, no more SGID binaries. Just make the front-end connect to
the back-end over a localhost socket and pass creds with sendmsg()
and SCM_CREDS (with regards to a mail.local equivallent).
-Matt