DanStaal/mini_sendmail

Fork of mini_sendmail (http://acme.com/software/mini_sendmail/) adding real username determination solution. Workaround for "can't determine username" error while running inside chroot jail. Removes getlogin(), getpwuid() dependencies by trying to get username from command line arguments. Get real username, does not use a fixed value causing nonsense logs. mini_sendmail reads its standard input up to an end-of-file and sends a copy of the message found there to all of the addresses listed. The message is sent by connecting to a local SMTP server. This means mini_sendmail can be used to send email from inside a chroot(2) area. Project homepage:

★ 0Forks 1GitHub ↗Compare

Project website ↗

README

mini_sendmail v1.3.9-f1

mini_sendmail 1.3.9-f1, Fork of mini_sendmail 1.3.9 adding an alternative username determination solution.

By Volkan Kucukcakar <vkucukcakar.github.com/v-mini-sendmail>

  • Workaround for "can't determine username" error while running inside chroot jail.
  • Removes getlogin(), getpwuid() dependencies by trying to get username from command line arguments.
  • Get real username, does not use a fixed value causing nonsense logs.

mini_sendmail reads its standard input up to an end-of-file and sends a copy of the message found there to all of the addresses listed. The message is sent by connecting to a local SMTP server. This means mini_sendmail can be used to send email from inside a chroot(2) area.

Example php.ini configuration:

sendmail_path = /usr/sbin/mini_sendmail -t -i --username examplechroot

Test:

$echo "Subject: This is the subject" | chroot /home/examplechroot.example.com /usr/sbin/mini_sendmail -v --username examplechroot [email protected]

mini_sendmail - accept email on behalf of real sendmail

version 1.3.9 of 19Oct2015

mini_sendmail reads its standard input up to an end-of-file and sends a copy of the message found there to all of the addresses listed. The message is sent by connecting to a local SMTP server. This means mini_sendmail can be used to send email from inside a chroot(2) area.

See the manual entry for more details.

Files in this distribution:

README		this
Makefile		guess
mini_sendmail.c	source file
mini_sendmail.8	manual entry

To build: If you're on a SysV-like machine (which includes old Linux systems but not new Linux systems), edit the Makefile and uncomment the SYSV_LIBS line. Otherwise, just do a make.

After it's built, you must test it to make sure your local sendmail daemon is (a) running and (b) accepting local mail for delivery elsewhere. Here's what a successful test run might look like:

% echo 'Subject: test' | ./mini_sendmail -v [email protected]
<<<< 220 gate.acme.com ESMTP Sendmail; Thu, 16 Dec 1999 17:17:37 -0800 (PST)
>>>> HELO localhost
<<<< 250 gate.acme.com Hello localhost [127.0.0.1], pleased to meet you
>>>> MAIL FROM:<[email protected]>
<<<< 250 <[email protected]>... Sender ok
>>>> RCPT TO:<[email protected]>
<<<< 250 <[email protected]>... Recipient ok
>>>> DATA
<<<< 354 Enter mail, end with "." on a line by itself
<<<< 250 RAA58877 Message accepted for delivery
>>>> QUIT
<<<< 221 gate.acme.com closing connection
% 

And here's an unsuccessful run where there's no local sendmail daemon running:

% echo 'Subject: test' | ./mini_sendmail -v [email protected]
./mini_sendmail: connect: Connection refused
% 

Feedback is welcome - send bug reports, enhancements, checks, money orders, etc. to the addresses below.

Jef Poskanzer  [email protected]  http://www.acme.com/jef/

Contributors

0xio-labs

Issues