+++ /dev/null
---- mutt-1.5.9/Makefile.am.orig 2005-03-31 20:44:06.543128320 +0200
-+++ mutt-1.5.9/Makefile.am 2005-03-31 20:48:44.552864416 +0200
-@@ -62,6 +62,7 @@
- mutt_tunnel.c pop.c pop_auth.c pop_lib.c smime.c pgp.c pgpinvoke.c pgpkey.c \
- pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
- browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c \
-+ mutt_libesmtp.c \
- crypt-mod-pgp-classic.c crypt-mod-smime-classic.c \
- pgppacket.c mutt_idna.h hcache.c mutt_ssl_gnutls.c \
- nntp.c newsrc.c \
-@@ -82,6 +83,7 @@
- makedoc.c stamp-doc-rc README.SSL smime.h\
- muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
- ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
-+ mutt_libesmtp.h \
- snprintf.c regex.c crypt-gpgme.h
-
- EXTRA_SCRIPTS = smime_keys
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/configure.in mutt-1.5.3/configure.in
---- mutt-1.5.3/configure.in Tue Dec 17 04:35:21 2002
-+++ mutt-1.5.3/configure.in Wed Mar 5 11:50:47 2003
-@@ -916,6 +916,19 @@
- AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
- fi
-
-+dnl -- libesmtp --
-+MUTT_AM_LIBESMTP
-+if test x$use_libesmtp = xyes; then
-+ CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
-+ MUTTLIBS="$MUTTLIBS $mutt_libesmtp_libs"
-+ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_libesmtp.o"
-+
-+ AC_DEFINE(USE_LIBESMTP,
-+ 1,
-+ [Define to enable the use of libesmtp])
-+fi
-+dnl -- end libesmtp --
-+
- AC_OUTPUT(Makefile intl/Makefile m4/Makefile
- po/Makefile.in doc/Makefile contrib/Makefile
- muttbug.sh
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/globals.h mutt-1.5.3/globals.h
---- mutt-1.5.3/globals.h Mon Sep 9 15:05:44 2002
-+++ mutt-1.5.3/globals.h Wed Mar 5 11:50:48 2003
-@@ -101,6 +101,12 @@
- WHERE char *Shell;
- WHERE char *Signature;
- WHERE char *SimpleSearch;
-+#if defined(USE_LIBESMTP)
-+WHERE char *SmtpAuthUser;
-+WHERE char *SmtpAuthPass;
-+WHERE char *SmtpHost;
-+WHERE unsigned short SmtpPort;
-+#endif
- WHERE char *Spoolfile;
- #if defined(USE_SSL) || defined(USE_NSS)
- WHERE char *SslCertFile INITVAL (NULL);
---- mutt-1.5.9/init.h.orig 2005-03-31 20:44:06.454141848 +0200
-+++ mutt-1.5.9/init.h 2005-03-31 20:49:49.479993992 +0200
-@@ -98,6 +98,9 @@
- # ifndef USE_SOCKET
- # define USE_SOCKET
- # endif
-+# ifndef USE_LIBESMTP
-+# define USE_LIBESMTP
-+# endif
- #endif
-
- struct option_t MuttVars[] = {
-@@ -1987,6 +1990,39 @@
- ** (S/MIME only)
- */
-
-+
-+#if defined(USE_LIBESMTP)
-+ { "smtp_auth_username", DT_STR, R_NONE, UL &SmtpAuthUser, 0 },
-+ /*
-+ ** .pp
-+ ** Defines the username to use with SMTP AUTH. Setting this variable will
-+ ** cause mutt to attempt to use SMTP AUTH when sending.
-+ */
-+ { "smtp_auth_password", DT_STR, R_NONE, UL &SmtpAuthPass, 0 },
-+ /*
-+ ** .pp
-+ ** Defines the password to use with SMTP AUTH. If ``$$smtp_auth_username''
-+ ** is set, but this variable is not, you will be prompted for a password
-+ ** when sending.
-+ */
-+ { "smtp_host", DT_STR, R_NONE, UL &SmtpHost, 0 },
-+ /*
-+ ** .pp
-+ ** Defines the SMTP host which will be used to deliver mail, as opposed
-+ ** to invoking the sendmail binary. Setting this variable overrides the
-+ ** value of ``$$sendmail'', and any associated variables.
-+ */
-+ { "smtp_port", DT_NUM, R_NONE, UL &SmtpPort, 25 },
-+ /*
-+ ** .pp
-+ ** Defines the port that the SMTP host is listening on for mail delivery.
-+ ** Must be specified as a number.
-+ ** .pp
-+ ** Defaults to 25, the standard SMTP port, but RFC 2476-compliant SMTP
-+ ** servers will probably desire 587, the mail submission port.
-+ */
-+#endif
-+
- #if defined(USE_SSL)||defined(USE_NSS)||defined(USE_GNUTLS)
- #ifdef USE_SSL
- { "ssl_client_cert", DT_PATH, R_NONE, UL &SslClientCert, 0 },
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/m4/libesmtp.m4 mutt-1.5.3/m4/libesmtp.m4
---- mutt-1.5.3/m4/libesmtp.m4 Wed Dec 31 18:00:00 1969
-+++ mutt-1.5.3/m4/libesmtp.m4 Wed Mar 5 11:52:36 2003
-@@ -0,0 +1,63 @@
-+dnl vim:ft=config:
-+
-+dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com>
-+dnl
-+dnl libesmtp often requires linking against -lpthread or -lc_r (BSD).
-+dnl This macro attempts to centralize this code.
-+
-+AC_DEFUN([MUTT_AM_LIBESMTP],
-+[
-+ AC_ARG_WITH(
-+ [libesmtp],
-+ [ --with-libesmtp=DIR Compile in support for libesmtp for the MTA],
-+ [ if test "$with_libesmtp" != "no"
-+ then
-+ mutt_libesmtp_check_path="$PATH"
-+
-+ if test "$with_libesmtp" != "yes"
-+ then
-+ mutt_libesmtp_check_path="$tmp_path:$withval/bin"
-+ fi
-+
-+ dnl 1. Find libesmtp-config
-+ AC_PATH_PROG([mutt_libesmtp_config_path],
-+ [libesmtp-config],
-+ [no],
-+ [$mutt_libesmtp_check_path])
-+
-+ if test "$mutt_libesmtp_config_path" = "no"
-+ then
-+ AC_MSG_ERROR([libesmtp-config binary not found.])
-+ fi
-+
-+ dnl 2. Get CFLAGS and LIBS from libesmtp-config
-+ mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags`
-+ mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs`
-+
-+ dnl 3. Verify libesmtp.h can be found with these settings
-+ temp_CFLAGS="$CFLAGS"
-+ CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
-+ AC_CHECK_HEADER([libesmtp.h],
-+ [],
-+ AC_MSG_ERROR([Could not find libesmtp.h]))
-+ CFLAGS="$temp_CFLAGS"
-+
-+ dnl 4. Verify the libesmtp library can be linked in
-+ temp_CFLAGS="$CFLAGS"
-+ temp_LIBS="$LIBS"
-+ CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
-+ LIBS="$LIBS $mutt_libesmtp_libs"
-+ AC_CHECK_LIB([esmtp],
-+ [smtp_create_session],
-+ [],
-+ AC_MSG_ERROR([Could not find libesmtp]))
-+ CFLAGS="$temp_CFLAGS"
-+ LIBS="$temp_LIBS"
-+
-+ dnl 5. Export use_libesmtp variable so configure.in can
-+ dnl act accordingly.
-+ use_libesmtp=yes
-+ fi
-+ ]
-+ )
-+])
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/main.c mutt-1.5.3/main.c
---- mutt-1.5.3/main.c Wed Dec 11 05:20:05 2002
-+++ mutt-1.5.3/main.c Wed Mar 5 11:50:48 2003
-@@ -240,6 +240,12 @@
- #else
- "-USE_SASL2 "
- #endif
-+
-+#ifdef USE_LIBESMTP
-+ "+USE_LIBESMTP "
-+#else
-+ "-USE_LIBESMTP "
-+#endif
- "\n"
-
- #ifdef HAVE_REGCOMP
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/mutt_libesmtp.c mutt-1.5.3/mutt_libesmtp.c
---- mutt-1.5.3/mutt_libesmtp.c Wed Dec 31 18:00:00 1969
-+++ mutt-1.5.3/mutt_libesmtp.c Wed Mar 5 11:53:42 2003
-@@ -0,0 +1,231 @@
-+#if HAVE_CONFIG_H
-+# include "config.h"
-+#endif
-+#include "mutt.h"
-+#include <errno.h>
-+#include <auth-client.h>
-+#include <libesmtp.h>
-+
-+static char authpass[STRING] = "";
-+
-+#define FAIL() \
-+ do { \
-+ ret = -1; \
-+ goto Done; \
-+ } while (0)
-+#define MSGFAIL(msg) \
-+ do { \
-+ mutt_error("%s", msg); \
-+ FAIL(); \
-+ } while (0)
-+#define LIBCFAIL(msg) \
-+ do { \
-+ mutt_error("%s: %s", msg, strerror(errno)); \
-+ FAIL(); \
-+ } while (0)
-+#define SMTPFAIL(msg) \
-+ do { \
-+ _mutt_libesmtp_perror(msg); \
-+ FAIL(); \
-+ } while (0)
-+
-+/*
-+ * _mutt_libesmtp_ensure_init
-+ * Make sure the libESMTP support in mutt is initialized at some time.
-+ */
-+static void
-+_mutt_libesmtp_ensure_init()
-+{
-+ static int libesmtp_init = 0;
-+
-+ if (!libesmtp_init) {
-+ if (SmtpAuthUser)
-+ auth_client_init();
-+ libesmtp_init = 1;
-+ }
-+}
-+
-+/*
-+ * _mutt_libesmtp_perror
-+ * Prints 'msg', a colon, and then a string representation of the
-+ * libesmtp errno as a mutt error.
-+ */
-+static void
-+_mutt_libesmtp_perror(const char* msg)
-+{
-+ char buf[512];
-+
-+ mutt_error("%s: %s", msg, smtp_strerror(smtp_errno(), buf, sizeof(buf)));
-+}
-+
-+/*
-+ * _mutt_libesmtp_add_recipients
-+ * Adds every address in 'addr' as a recipient to the smtp message
-+ * 'message'. Note that this does not mean that they will necessarily
-+ * show up in the mail headers (e.g., when bcc'ing). Returns 0 upon
-+ * success, -1 upon failure (and prints an error message).
-+ *
-+ * Very similar to sendlib.c::add_args
-+ */
-+static int
-+_mutt_libesmtp_add_recipients(smtp_message_t message, ADDRESS *addr)
-+{
-+ int ret = 0;
-+
-+ for (; addr; addr = addr->next) {
-+ /* weed out group mailboxes, since those are for display only */
-+ if (addr->mailbox && !addr->group) {
-+ if (!smtp_add_recipient(message, addr->mailbox))
-+ SMTPFAIL("smtp_add_recipient");
-+ }
-+ }
-+
-+Done:
-+ return ret;
-+}
-+
-+static int
-+_mutt_libesmtp_auth_interact(auth_client_request_t request,
-+ char **result, int fields, void *arg)
-+{
-+ int i;
-+
-+ for (i = 0; i < fields; i++) {
-+ if (request[i].flags & AUTH_USER) {
-+ result[i] = SmtpAuthUser;
-+ } else if (request[i].flags & AUTH_PASS) {
-+ if (SmtpAuthPass) {
-+ result[i] = SmtpAuthPass;
-+ } else {
-+ if (authpass[0] == '\0') {
-+ char prompt[STRING];
-+
-+ snprintf(prompt, sizeof(prompt), "%s%s: ", request[i].prompt,
-+ (request[i].flags & AUTH_CLEARTEXT) ? " (not encrypted)" : "");
-+ mutt_get_password(prompt, authpass, sizeof(authpass));
-+ }
-+ result[i] = authpass;
-+ }
-+ }
-+ }
-+
-+ return 1;
-+}
-+
-+#define BUFLEN 8192
-+
-+static const char*
-+_mutt_libesmtp_messagefp_cb(void **buf, int *len, void *arg)
-+{
-+ int octets;
-+
-+ if (*buf == NULL)
-+ *buf = malloc(BUFLEN);
-+
-+ if (len == NULL) {
-+ rewind((FILE*) arg);
-+ return NULL;
-+ }
-+
-+ if (fgets(*buf, BUFLEN - 2, (FILE*) arg) == NULL) {
-+ octets = 0;
-+ } else {
-+ char* p = strchr(*buf, '\0');
-+
-+ if (p[-1] == '\n' && p[-2] != '\r') {
-+ strcpy(p - 1, "\r\n");
-+ p++;
-+ }
-+ octets = p - (char*) *buf;
-+ }
-+
-+ *len = octets;
-+ return *buf;
-+}
-+
-+/*
-+ * mutt_invoke_libesmtp
-+ * Sends a mail message to the provided recipients using libesmtp.
-+ * Returns 0 upon success, -1 upon failure (and prints an error
-+ * message).
-+ */
-+int
-+mutt_invoke_libesmtp(ADDRESS *from, /* the sender */
-+ ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
-+ const char *msg, /* file containing message */
-+ int eightbit) /* message contains 8bit chars */
-+{
-+ int ret = 0; /* return value, default = success */
-+ smtp_session_t session;
-+ smtp_message_t message;
-+ char* hostportstr = NULL;
-+ size_t hostportlen;
-+ FILE* fp = NULL;
-+ auth_context_t authctx = NULL;
-+ const smtp_status_t* status;
-+
-+ _mutt_libesmtp_ensure_init();
-+
-+ if ((session = smtp_create_session()) == NULL)
-+ SMTPFAIL("smtp_create_session");
-+
-+ /* Create hostname:port string and tell libesmtp */
-+ /* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
-+ hostportlen = strlen(SmtpHost) + 7;
-+ hostportstr = safe_malloc(hostportlen);
-+ snprintf(hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
-+ if (!smtp_set_server(session, hostportstr))
-+ SMTPFAIL("smtp_set_server");
-+
-+ if (SmtpAuthUser) {
-+ if ((authctx = auth_create_context()) == NULL)
-+ MSGFAIL("auth_create_context failed");
-+ auth_set_mechanism_flags(authctx, AUTH_PLUGIN_PLAIN, 0);
-+ auth_set_interact_cb(authctx, _mutt_libesmtp_auth_interact, NULL);
-+
-+ if (!smtp_auth_set_context(session, authctx))
-+ SMTPFAIL("smtp_auth_set_context");
-+ }
-+
-+ if ((message = smtp_add_message(session)) == NULL)
-+ SMTPFAIL("smtp_add_message");
-+ /* Initialize envelope sender */
-+ if (!smtp_set_reverse_path(message, from->mailbox))
-+ SMTPFAIL("smtp_set_reverse_path");
-+
-+ if ((fp = fopen(msg, "r")) == NULL)
-+ LIBCFAIL("fopen");
-+ if (!smtp_set_messagecb(message, _mutt_libesmtp_messagefp_cb, fp))
-+ SMTPFAIL("smtp_set_messagecb");
-+ if (_mutt_libesmtp_add_recipients(message, to))
-+ FAIL();
-+ if (_mutt_libesmtp_add_recipients(message, cc))
-+ FAIL();
-+ if (_mutt_libesmtp_add_recipients(message, bcc))
-+ FAIL();
-+ if (!smtp_start_session(session))
-+ SMTPFAIL("smtp_start_session");
-+
-+ status = smtp_message_transfer_status(message);
-+ if (status->code < 200 || status->code > 299) {
-+ char buf[256];
-+ snprintf(buf, sizeof(buf), "SMTP error while sending: %d %s", status->code, status->text);
-+ MSGFAIL(buf);
-+ }
-+
-+Done:
-+ if (fp != NULL)
-+ fclose(fp);
-+ if (hostportstr != NULL)
-+ free(hostportstr);
-+ if (session != NULL)
-+ smtp_destroy_session(session);
-+ if (authctx != NULL)
-+ auth_destroy_context(authctx);
-+
-+ /* Forget user-entered SMTP AUTH password if send fails */
-+ if (ret != 0)
-+ authpass[0] = '\0';
-+
-+ return ret;
-+}
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/mutt_libesmtp.h mutt-1.5.3/mutt_libesmtp.h
---- mutt-1.5.3/mutt_libesmtp.h Wed Dec 31 18:00:00 1969
-+++ mutt-1.5.3/mutt_libesmtp.h Wed Mar 5 11:50:48 2003
-@@ -0,0 +1,10 @@
-+#if !defined(LIBESMTP_H)
-+#define LIBESMTP_H
-+
-+int
-+mutt_invoke_libesmtp (ADDRESS *from, /* the sender */
-+ ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
-+ const char *msg, /* file containing message */
-+ int eightbit); /* message contains 8bit chars */
-+
-+#endif /* !defined(LIBESMTP_H) */
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/protos.h mutt-1.5.3/protos.h
---- mutt-1.5.3/protos.h Wed Dec 11 16:31:25 2002
-+++ mutt-1.5.3/protos.h Wed Mar 5 11:50:48 2003
-@@ -279,7 +279,7 @@
- int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
- int mutt_get_tmp_attachment (BODY *);
- int mutt_index_menu (void);
--int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
-+int mutt_invoke_mta (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
- int mutt_is_autoview (BODY *, const char *);
- int mutt_is_mail_list (ADDRESS *);
- int mutt_is_message_type(int, const char *);
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/send.c mutt-1.5.3/send.c
---- mutt-1.5.3/send.c Wed Dec 11 16:45:38 2002
-+++ mutt-1.5.3/send.c Wed Mar 5 11:50:48 2003
-@@ -979,7 +979,7 @@
- return mix_send_message (msg->chain, tempfile);
- #endif
-
-- i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc,
-+ i = mutt_invoke_mta (msg->env->from, msg->env->to, msg->env->cc,
- msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT));
- return (i);
- }
-diff -urN --exclude-from=bin/diff.excludes mutt-1.5.3/sendlib.c mutt-1.5.3/sendlib.c
---- mutt-1.5.3/sendlib.c Tue Dec 10 14:57:11 2002
-+++ mutt-1.5.3/sendlib.c Wed Mar 5 11:50:48 2003
-@@ -123,6 +123,9 @@
- #include "smime.h"
- #endif /* HAVE_SMIME */
-
-+#ifdef USE_LIBESMTP
-+# include "mutt_libesmtp.h"
-+#endif /* USE_LIBESMTP */
-
-
- #define DISPOSITION(X) X==DISPATTACH?"attachment":"inline"
-@@ -2009,7 +2012,7 @@
- }
-
-
--int
-+static int
- mutt_invoke_sendmail (ADDRESS *from, /* the sender */
- ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
- const char *msg, /* file containing message */
-@@ -2105,6 +2108,20 @@
- return (i);
- }
-
-+int
-+mutt_invoke_mta (ADDRESS *from, /* the sender */
-+ ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */
-+ const char *msg, /* file containing message */
-+ int eightbit) /* message contains 8bit chars */
-+{
-+#ifdef USE_LIBESMTP
-+ if (SmtpHost)
-+ return mutt_invoke_libesmtp(from, to, cc, bcc, msg, eightbit);
-+#endif
-+
-+ return mutt_invoke_sendmail(from, to, cc, bcc, msg, eightbit);
-+}
-+
- /* appends string 'b' to string 'a', and returns the pointer to the new
- string. */
- char *mutt_append_string (char *a, const char *b)
-@@ -2261,7 +2278,7 @@
- mutt_copy_bytes (fp, f, h->content->length);
- fclose (f);
-
-- ret = mutt_invoke_sendmail (env_from, to, NULL, NULL, tempfile,
-+ ret = mutt_invoke_mta (env_from, to, NULL, NULL, tempfile,
- h->content->encoding == ENC8BIT);
- }
-
---- mutt-1.4.1.org/Muttrc.esmtp 1970-01-01 01:00:00.000000000 +0100
-+++ mutt-1.4.1/Muttrc.esmtp 2003-08-21 14:57:35.000000000 +0200
-@@ -0,0 +1,20 @@
-+# enable minimalistic smtp support builtin to Mutt
-+set sendmail = "builtin"
-+
-+# The name or address of your SMTP server.
-+set smtp_serv = "fastmail.fm"
-+
-+# Your login name on the SMTP server. Mutt presents you
-+# as ``smtp_user''@``smtp_host'', unless ``envelope_from''
-+# is set, this will then be the message's envelope sender.
-+# Defaults to your login name on the local system.
-+set smtp_user = "ulferikson"
-+
-+# If set, Mutt will try to use ESMPT and ``AUTH LOGIN'' to
-+# authenticate your user.
-+set smtp_pass = ""
-+
-+# This variable specifies which port your SMTP server is
-+# listening on.
-+set smtp_port = 25
-+