Commit c3c25fcd authored by Salvatore Bonaccorso's avatar Salvatore Bonaccorso

Imported Upstream version 1.2

parents
José Fonseca <jrfonseca@users.sourceforge.net>
This diff is collapsed.
This diff is collapsed.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
AM_CFLAGS= -DSYSCONFDIR=\"@sysconfdir@\"
bin_PROGRAMS = esmtp
dist_man_MANS = esmtp.1 esmtprc.5
esmtp_SOURCES = \
lexer.l \
list.h \
local.c \
local.h \
main.c \
main.h \
message.c \
message.h \
parser.y \
rcfile.h \
rfc822.c \
rfc822.h \
smtp.c \
smtp.h \
xmalloc.h
BUILT_SOURCES = parser.h
EXTRA_DIST = \
sample.esmtprc \
esmtp-wrapper
AM_YFLAGS = -d
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir)
rm -f $(DESTDIR)$(sbindir)/sendmail
rm -f $(DESTDIR)$(libdir)/sendmail
rm -f $(DESTDIR)$(bindir)/mailq
rm -f $(DESTDIR)$(bindir)/newaliases
$(LN_S) $(bindir)/esmtp $(DESTDIR)$(sbindir)/sendmail
$(LN_S) $(bindir)/esmtp $(DESTDIR)$(libdir)/sendmail
$(LN_S) $(bindir)/esmtp $(DESTDIR)$(bindir)/mailq
$(LN_S) $(bindir)/esmtp $(DESTDIR)$(bindir)/newaliases
install-data-hook:
rm -f $(DESTDIR)$(man1dir)/sendmail.1
rm -f $(DESTDIR)$(man1dir)/mailq.1
rm -f $(DESTDIR)$(man1dir)/newaliases.1
$(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/sendmail.1
$(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/mailq.1
$(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/newaliases.1
This diff is collapsed.
News
~~~~
* Version 1.2 (2009-12-24):
* Make force_mda in the esmtprc to work with the -t option (based on patch
by Sourav K. Mandal)
* Version 1.1 (2009-12-16):
* Option to force local only MDA (Robert A.M. Diamond).
* Use locking in esmtp-wrapper (Phil Sutter).
* Update mutt option name in the user manual (Wu Fengguang).
* Version 1.0 (2008-10-09):
* Fix NTLM authentication (Nils Rennebarth).
* Option to disable Message-ID header (Phil Sutter).
* Version 0.6.0 (2007-09-03):
* Handle CR-LF newline endings when parsing the headers.
* Wrapper script for off-line mail delivery (Phil Sutter).
* Document how to get CA certificates.
* Corrections to the manpages (Reuben Thomas).
* Tips for adding missing Date: headers in messages for local delivery
(Bruce Schultz).
* Use a reasonable default for the reverse path when one is not
specified, instead of an empty one.
* Prevent segfault expanding %F in the MDA string when the reverse
path is not specified.
* Version 0.5.1 (2005-03-10):
* A 'postconnect' keyword to execute a command after closing a SMTP
connection.
* Do not attempt to authenticate if no username/password is given.
* Several configuration fixes/enhancements (SASAJIMA and Dirk Tilger).
* Enforce strict permissions on configuration file (Tiago Macambira).
* Allow to set helo-name. Allow to send out local mail as remote mail
by adding a qualifying domain name. Allow forcing envelope-from and Sender
headers. Drop possible admin-added sgid priveleges to be dropped after
reading the config. (Bernhard Link)
* Do not pass multiple address to the MDA quoted as a single argument
(Kusanagi Kouichi).
* Version 0.5.0 (2003-11-14):
* Fixed another bug which prevented to send mail when libesmtp had no
openssl support (Maurice Galland).
* Detailed documentation on how to use the StartTLS extension. More
verbosity on StartTLS error messages.
* New 'preconnect' keyword to execute a command prior to opening a SMTP
connection (Daniel Richard G.).
* Fixed a bug which prevented to send mail when libesmtp had no
openssl support (Tomas Kondor).
* New 'default' keyword for identities (Vitezslav Batrla).
* Version 0.4.1 (2003-07-14):
* Packaging fixes.
* Esmtprc man page.
* Fixed the MDA return status which wasn't being cheked.
* Fixed a bug the input buffering which when using the '-t' option and
piping the input caused the parsed headers to be lost.
* Version 0.4 (2003-07-12):
* Debian packaging.
* Fixes to compile on FreeBSD (Tim Hemel).
* Local delivery via a MDA.
* Extraction of the recipients from the headers ('-t' option).
* 8bit-MIME extension support ('-B' option).
* Further Delivery Status Notification support ('-R' and '-V' options).
* Version 0.3 (2003-03-10):
* Capability to generate log files.
* Better verbose output.
* Minor bug fixes and documentation enhancements.
* Multiple identities (Jerome).
* Version 0.2 (2002-10-31):
* Packaging corrections.
* Minor bug fixes and documentation enhancements.
* Use sendmail exit codes.
* Version 0.1 (2002-09-26):
* Initial release.
This diff is collapsed.
-----
To Do
-----
<<esmtp>> already fulfills all my needs, and I don't plan to spend much more
time on it besides bug fixing.
Here is a list of what can still be done:
* Write a comprehensive test suite.
* Alias expansion.
dnl @synopsis adl_FUNC_GETOPT_LONG
dnl
dnl Check for getopt_long support.
dnl
dnl This assume that the standard getopt.h file (from GNU libc) is
dnl available as lib/gnugetopt.h. If needed, this file will be linked
dnl as getopt.h, but we want to default to the system's getopt.h file.
dnl (See http://sources.redhat.com/ml/automake/2000-09/msg00041.html
dnl for an explanation about why using the system's getopt.h file is
dnl important.)
dnl
dnl @category InstalledPackages
dnl @author Alexandre Duret-Lutz <adl@gnu.org>
dnl @version 2003-10-29
dnl @license GPLWithACException
AC_DEFUN([adl_FUNC_GETOPT_LONG],
[AC_PREREQ(2.49)dnl
# clean out junk possibly left behind by a previous configuration
rm -f lib/getopt.h
# Check for getopt_long support
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_FUNCS([getopt_long],,
[# FreeBSD has a gnugetopt library for this
AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])],
[# use the GNU replacement
AC_LIBOBJ(getopt)
AC_LIBOBJ(getopt1)
AC_CONFIG_LINKS([lib/getopt.h:lib/gnugetopt.h])])])])
dnl Same as above, but we don't need getopt_long -- just plain getopt --,
dnl and weren't including a GNU replacement .
AC_DEFUN([jrf_FUNC_GETOPT],
[AC_PREREQ(2.49)dnl
# Check for getopt_long support
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_FUNCS([getopt],,
[# FreeBSD has a gnugetopt library for this
AC_CHECK_LIB([gnugetopt],[getopt],[AC_DEFINE([HAVE_GETOPT])],
[])])])
This diff is collapsed.
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
This diff is collapsed.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.65)
AC_INIT(esmtp, 1.2)
AC_CONFIG_SRCDIR(Makefile.am)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE(1.11 dist-bzip2)
AM_MAINTAINER_MODE
AC_PROG_CC
AC_HEADER_STDC
dnl getopt needs this
AC_C_CONST
AC_PROG_LEX
AC_PROG_LN_S
AC_PROG_YACC
dnl Check for libESMTP
AC_ARG_WITH(libesmtp,
AC_HELP_STRING([--with-libesmtp=DIR],
[use libesmtp library from (prefix) directory DIR]),
,)
if test "$with_libesmtp" != "no" -a "$with_libesmtp" != "yes"
then
CPPFLAGS="$CPPFLAGS -I$with_libesmtp/include"
LDFLAGS="$LDFLAGS -L$with_libesmtp/lib"
AC_CHECK_HEADER(libesmtp.h, ,[AC_MSG_ERROR([libesmtp.h not found in $with_libesmtp])])
fi
AC_MSG_CHECKING(for libESMTP)
if libesmtp-config --version > /dev/null 2>&1
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS `libesmtp-config --cflags`"
LIBS="$LIBS `libesmtp-config --libs`"
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(libESMTP library not found)
fi
jrf_FUNC_GETOPT
AC_CHECK_FUNCS([getuid geteuid])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
This diff is collapsed.
#!/bin/bash
# Esmtp-wrapper adds shell based queueing support to esmtp.
# Copyright (C) 2007 by Phil Sutter <phil@nwl.cc>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
qdir="$HOME/.esmtp_queue"
deliver_lock="$qdir/.deliver_lock"
esmtp="/usr/bin/esmtp"
mktemp="/bin/mktemp"
dotlockfile="/usr/bin/dotlockfile"
__do_check_program() { # (path to program)
[ -x "$1" ] || { \
echo "required program '$1' not found, exiting"
exit 1
}
}
check_programs() { # ()
__do_check_program "$esmtp"
__do_check_program "$mktemp"
__do_check_program "$dotlockfile"
}
queue_mail() { # ($@)
local ret=0
mkdir -p "$qdir" || {
echo "unable to create queue dir $qdir" 2>&1
return 1
}
mdir="`$mktemp -d "$qdir/XXXXXXXX"`"
[ -d "$mdir" ] || {
echo "unable to create tempdir inside $qdir" 2>&1
return 1
}
touch "$mdir/lock"
echo "$@" >"$mdir/cmd" || ret=1
cat </dev/stdin >"$mdir/mail" || ret=1
[ $ret -eq 0 ] || {
echo "could not enqueue mail in dir $mdir" 2>&1
return 1
}
chmod 0600 $mdir/* || echo "warning setting secure permissions failed!" 2>&1
rm "$mdir/lock"
return 0
}
show_mail() { # ($mdir)
echo "mail in dir $1:"
printf '\t%s' "`grep ^From: "$1/mail"`"
printf '\t%s' "`grep ^To: "$1/mail"`"
[ -f "$1/lock" ] && printf '\t%s' "[LOCKED]"
printf '\t%s\n' "`grep ^Date: "$1/mail"`"
}
show_queue() { # ()
local i=0
local lockwarn=0
for dir in $qdir/*; do
[ ! -d "$dir" ] && continue
[ -f "$dir/lock" ] && lockwarn=1
show_mail $dir
let i++
done
echo "$i mails to deliver"
[ $lockwarn -eq 0 ] || { \
printf '\n%s\n' "Warning: locked mails in queue!"; \
printf '%s' "This means that either enqueueing is in "; \
printf '%s\n' "progress, or it failed for some reason."; \
}
}
send_mail() { # ($mdir)
$esmtp $(<"$1/cmd") <"$1/mail" && \
rm -rf "$1" || return 1
return $?
}
deliver_queue() { # ([background])
local undelivered=0
# when delivering in background, there is time to wait
# for a potential burst run (git-send-email, e.g.) or
# exiting of other delivery jobs.
if [[ "$1" = "background" ]]; then
sleep 5
fi
if ! $dotlockfile -p -l "$deliver_lock"; then
return 1
fi
for dir in $qdir/*; do
[ ! -d "$dir" ] && continue
[ -f "$dir/lock" ] && continue
send_mail "$dir"
undelivered=`expr $undelivered + $?`
done
$dotlockfile -u "$deliver_lock"
return $undelivered
}
ME=`basename "$0"`
check_programs # possible program exit point
case "$ME" in
sendmail|esmtp)
queue_mail "$@" || return 1
deliver_queue "background" &
;;
deliver)
deliver_queue
;;
mailq)
if [ x"$1" = x"-q" ]; then
deliver_queue
else
show_queue
fi
;;
*)
exit 1
;;
esac
exit $?
.\" Based on ssmtp.1 and sendmail.8 man pages of the sSMTP and
.\" sendmail distributions respectively.
.\"
.\" Portions are
.\" Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.TH ESMTP 1
.SH NAME
esmtp
\-
libESMTP to Sendmail compatibility interface
.SH SYNOPSIS
\fBesmtp\fR [\fIflags\fR] [\fIaddress ...\fR]
.br
\fBsendmail\fR [\fIflags\fR] [\fIaddress ...\fR]
\fBmailq\fR
.br
\fBsendmail -bp\fR
\fBnewaliases\fR
.br
\fBsendmail -bi\fR
.SH DESCRIPTION
\fBEsmtp\fR is a send-only \fBsendmail\fR emulator for machines which normally
retrieve their mail from a centralized mailhub using programs such as
\fBfetchmail\fR.
\fBEsmtp\fR does not attempt to provide all the functionality of
\fBsendmail\fR: it is intended to be used by mail user agents as \fBmutt\fR.
.SH OPTIONS
Most \fBsendmail\fR options are irrelevant to \fBesmtp\fR . Those marked
``ignored'' or ``default'' have no effect on mail transfer. Those marked
``unsupported'' are fatal errors.
.TP
\fB\-Ac\fR (ignored)
Use submit.cf even if the operation mode does not indicate an initial mail
submission.
.TP
\fB\-Am\fR (ignored)
Use sendmail.cf even if the operation mode indicates an initial mail
submission.
.TP
\fB\-B\fR \fItype\fR
Set the body type to \fItype\fR. Current legal values are 7BIT or 8BITMIME.
.TP
\fB\-ba\fR (unsupported)
Go into ARPANET mode.
.TP
\fB\-bd\fR (unsupported)
Run as a daemon.
.TP
\fB\-bD\fR (unsupported)
Same as \fB\-bd\fR except runs in foreground.
.TP
\fB\-bh\fR (unsupported)