WHERE char Quotebuf[STRING];
-WHERE address_t *EnvFrom;
WHERE address_t *From;
WHERE char *AssumedCharset;
WHERE short PagerContext;
WHERE short PagerIndexLines;
WHERE short ReadInc;
-WHERE short SendmailWait;
WHERE short SleepTime INITVAL (1);
WHERE short Timeout;
WHERE short Umask INITVAL (0077);
** you must take care of space-stuffing <tt/From / lines (with a trailing
** space) yourself.
*/
- {"envelope_from", DT_SYN, R_NONE, UL "use_envelope_from", 0 },
- {"use_envelope_from", DT_BOOL, R_NONE, OPTENVFROM, "no" },
- /*
- ** .pp
- ** When \fIset\fP, Madmutt will use ``$$envelope_from_address'' as the
- ** \fIenvelope\fP sender if that is set, otherwise it will attempt to
- ** derive it from the "From:" header.
- **
- ** .pp
- ** \fBNote:\fP This information is passed
- ** to sendmail command using the "-f" command line switch and
- ** passed to the SMTP server for libESMTP (if support is compiled in).
- */
- {"envelope_from_address", DT_ADDR, R_NONE, UL &EnvFrom, "" },
- /*
- ** .pp
- ** Manually sets the \fIenvelope\fP sender for outgoing messages.
- ** This value is ignored if ``$$use_envelope_from'' is unset.
- */
{"fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, "no" },
/*
** .pp
** (S/MIME only)
*/
#if defined(USE_LIBESMTP)
- {"smtp_auth_username", DT_SYN, R_NONE, UL "smtp_user", 0},
{"smtp_user", DT_STR, R_NONE, UL &SmtpAuthUser, "" },
/*
** .pp
** Defines the username to use with SMTP AUTH. Setting this variable will
** cause Madmutt to attempt to use SMTP AUTH when sending.
*/
- {"smtp_auth_password", DT_SYN, R_NONE, UL "smtp_pass", 0},
{"smtp_pass", DT_STR, R_NONE, UL &SmtpAuthPass, "" },
/*
** .pp
** presents a security risk since the superuser of your machine may read it
** regardless of the file's permissions.
*/
- {"smtp_envelope", DT_SYN, R_NONE, UL "envelope_from_address", 0 },
{"smtp_host", DT_STR, R_NONE, UL &SmtpHost, "" },
/*
** .pp
** \fTiso-8859-2\fP, \fTkoi8-r\fP or \fTiso-2022-jp\fP) either
** instead of or after \fTiso-8859-1\fP.
*/
- {"sendmail_wait", DT_NUM, R_NONE, UL &SendmailWait, "0" },
- /*
- ** .pp
- ** Specifies the number of seconds to wait for the ``$$sendmail'' process
- ** to finish before giving up and putting delivery in the background.
- ** .pp
- ** Madmutt interprets the value of this variable as follows:
- ** .dl
- ** .dt >0 .dd number of seconds to wait for sendmail to finish before continuing
- ** .dt 0 .dd wait forever for sendmail to finish
- ** .dt <0 .dd always put sendmail in the background without waiting
- ** .de
- ** .pp
- ** Note that if you specify a value other than 0, the output of the child
- ** process will be put in a temporary file. If there is some error, you
- ** will be informed as to where to find the output.
- */
#ifdef USE_NNTP
{"nntp_save_unsubscribed", DT_BOOL, R_NONE, OPTSAVEUNSUB, "no" },
/*
** This sets the umask that will be used by Madmutt when creating all
** kinds of files. If \fIunset\fP, the default value is \fT077\fP.
*/
- {"use_8bitmime", DT_BOOL, R_NONE, OPTUSE8BITMIME, "no" },
- /*
- ** .pp
- ** \fBWarning:\fP do not set this variable unless you are using a version
- ** of sendmail which supports the \fT-B8BITMIME\fP flag (such as sendmail
- ** 8.8.x) or in connection with the SMTP support via libESMTP.
- ** Otherwise you may not be able to send mail.
- ** .pp
- ** When \fIset\fP, Madmutt will either invoke ``$$sendmail'' with the \fT-B8BITMIME\fP
- ** flag when sending 8-bit messages to enable ESMTP negotiation or tell
- ** libESMTP to do so.
- */
{"use_from", DT_BOOL, R_NONE, OPTUSEFROM, "yes" },
/*
** .pp
.push = lua_pushboolean($L, $$);
};
+@type int {
+ .ctype = int;
+ .check = luaL_checkinteger($L, $$);
+ .push = lua_pushinteger($L, $$);
+};
+
@type quadopt_t {
.ctype = unsigned : 2;
.check = luaM_checkquadopt($L, $$);
.dtor = rx_delete($$);
};
+@type address_t {
+ .ctype = address_t *;
+ .check = luaL_checkstring($L, $$);
+ .push = luaM_pushaddr($L, $$);
+ .ctor = rfc822_parse_adrlist(NULL, $$);
+ .dtor = address_list_wipe($$);
+};
+
/* vim:set ft=c: */
#include <lualib.h>
#include <lauxlib.h>
+#include <lib-mime/mime-types.h>
#include "lua-token.h"
/* possible arguments to set_quadoption() */
void luaM_pushquadopt(lua_State *Ls, int val);
const char *luaM_checkrx(lua_State *Ls, int narg);
-char *luaM_pathnew(const char *val);
rx_t *luaM_rxnew(const char* val);
+char *luaM_pathnew(const char *val);
+void luaM_pushaddr(lua_State *Ls, address_t *addr);
#include "madmutt.li"
## dsn_notify
## dsn_return
## editor
+## envelope_from_address
## gecos_mask
## hcache_backend
## homedir
## no
## quit
## sendmail
+## sendmail_wait
## shell
## sysconfdir
## tmpdir
+## use_8bitmime
## use_domain
+## use_envelope_from
## username
## version
## yes
*/
/* TODO: check it's never, delay, failure, success with ',' */
string_t dsn_return = NULL;
+
+ /*
+ ** .pp
+ ** Specifies the number of seconds to wait for the ``$$sendmail'' process
+ ** to finish before giving up and putting delivery in the background.
+ ** .pp
+ ** Madmutt interprets the value of this variable as follows:
+ ** .dl
+ ** .dt >0 .dd number of seconds to wait for sendmail to finish before continuing
+ ** .dt 0 .dd wait forever for sendmail to finish
+ ** .dt <0 .dd always put sendmail in the background without waiting
+ ** .de
+ ** .pp
+ ** Note that if you specify a value other than 0, the output of the child
+ ** process will be put in a temporary file. If there is some error, you
+ ** will be informed as to where to find the output.
+ */
+ int sendmail_wait = 0;
+ /*
+ ** .pp
+ ** \fBWarning:\fP do not set this variable unless you are using a version
+ ** of sendmail which supports the \fT-B8BITMIME\fP flag (such as sendmail
+ ** 8.8.x) or in connection with the SMTP support via libESMTP.
+ ** Otherwise you may not be able to send mail.
+ ** .pp
+ ** When \fIset\fP, Madmutt will either invoke ``$$sendmail'' with the \fT-B8BITMIME\fP
+ ** flag when sending 8-bit messages to enable ESMTP negotiation or tell
+ ** libESMTP to do so.
+ */
+ bool use_8bitmime = 0;
+
+ /*
+ ** .pp
+ ** When \fIset\fP, Madmutt will use ``$$envelope_from_address'' as the
+ ** \fIenvelope\fP sender if that is set, otherwise it will attempt to
+ ** derive it from the "From:" header.
+ **
+ ** .pp
+ ** \fBNote:\fP This information is passed
+ ** to sendmail command using the "-f" command line switch and
+ ** passed to the SMTP server for libESMTP (if support is compiled in).
+ */
+ bool use_envelope_from = 0;
+
+ /*
+ ** .pp
+ ** Manually sets the \fIenvelope\fP sender for outgoing messages.
+ ** This value is ignored if ``$$use_envelope_from'' is unset.
+ */
+ address_t envelope_from_address = NULL;
};
/* vim:set ft=c: */
return s;
}
+rx_t *luaM_rxnew(const char *val)
+{
+ if (m_strisempty(val))
+ val = ".";
+
+ return rx_compile(val, mutt_which_case(val));
+}
+
char *luaM_pathnew(const char *val)
{
char path[PATH_MAX];
return m_strdup(path);
}
-rx_t *luaM_rxnew(const char *val)
-{
- if (m_strisempty(val))
- val = ".";
- return rx_compile(val, mutt_which_case(val));
+void luaM_pushaddr(lua_State *Ls, address_t *addr)
+{
+ char s[HUGE_STRING] = "";
+ rfc822_addrcat(s, sizeof(s), addr, 0);
+ lua_pushstring(Ls, s);
}
-
OPTDUPTHREADS,
OPTEDITHDRS,
OPTENCODEFROM,
- OPTENVFROM,
OPTFASTREPLY,
OPTFCCATTACH,
OPTFCCCLEAR,
OPTTHREADRECEIVED,
OPTTILDE,
OPTUNCOLLAPSEJUMP,
- OPTUSE8BITMIME,
OPTUSEFROM,
OPTUSEGPGAGENT,
#ifdef HAVE_LIBIDN
SMTPFAIL ("smtp_add_message");
/* Initialize envelope sender */
- if (option (OPTENVFROM) && EnvFrom)
- envfrom = EnvFrom->mailbox;
+ if (MTransport.use_envelope_fromoption && MTransport.envelope_from_address)
+ envfrom = MTransport.envelope_from_address->mailbox;
if (!smtp_set_reverse_path (message, envfrom))
SMTPFAIL ("smtp_set_reverse_path");
do_dsn_ret (message);
/* set up 8bitmime flag */
- if (eightbit && option (OPTUSE8BITMIME))
+ if (eightbit && MTransport.use_8bitmime)
smtp_8bitmime_set_body (message, E8bitmime_8BITMIME);
if ((fp = fopen (msg, "r")) == NULL)
sigaddset (&set, SIGTSTP);
sigprocmask (SIG_BLOCK, &set, NULL);
- if (SendmailWait >= 0) {
+ if (MTransport.sendmail_wait >= 0) {
char tmp[_POSIX_PATH_MAX];
mutt_mktemp (tmp);
}
unlink (msg);
- if (SendmailWait >= 0) {
+ if (MTransport.sendmail_wait >= 0) {
/* *tempfile will be opened as stdout */
if (open (*tempfile, O_WRONLY | O_APPEND | O_CREAT | O_EXCL, 0600) <
0)
_exit (S_ERR);
}
- /* SendmailWait > 0: interrupt waitpid() after SendmailWait seconds
- * SendmailWait = 0: wait forever
- * SendmailWait < 0: don't wait
+ /* sendmail_wait > 0: interrupt waitpid() after sendmail_wait seconds
+ * sendmail_wait = 0: wait forever
+ * sendmail_wait < 0: don't wait
*/
- if (SendmailWait > 0) {
+ if (MTransport.sendmail_wait > 0) {
SigAlrm = 0;
act.sa_handler = alarm_handler;
#ifdef SA_INTERRUPT
#endif
sigemptyset (&act.sa_mask);
sigaction (SIGALRM, &act, &oldalrm);
- alarm (SendmailWait);
+ alarm (MTransport.sendmail_wait);
}
- else if (SendmailWait < 0)
+ else if (MTransport.sendmail_wait < 0)
_exit (0xff & EX_OK);
if (waitpid (pid, &st, 0) > 0) {
st = WIFEXITED (st) ? WEXITSTATUS (st) : S_ERR;
- if (SendmailWait && st == (0xff & EX_OK)) {
+ if (MTransport.sendmail_wait && st == (0xff & EX_OK)) {
unlink (*tempfile); /* no longer needed */
p_delete(tempfile);
}
} else {
- st = (SendmailWait > 0 && errno == EINTR && SigAlrm) ? S_BKG : S_ERR;
- if (SendmailWait > 0) {
+ st = (MTransport.sendmail_wait > 0 && errno == EINTR && SigAlrm) ? S_BKG : S_ERR;
+ if (MTransport.sendmail_wait > 0) {
unlink (*tempfile);
p_delete(tempfile);
}
#ifdef USE_NNTP
if (!option (OPTNEWSSEND)) {
#endif
- if (eightbit && option (OPTUSE8BITMIME))
+ if (eightbit && MTransport.use_8bitmime)
args = add_option(args, &argslen, &argsmax, "-B8BITMIME");
- if (option (OPTENVFROM)) {
- address_t *f = EnvFrom;
- if (EnvFrom)
- f = EnvFrom;
- else if (from && !from->next)
+ if (MTransport.use_envelope_from) {
+ address_t *f = MTransport.envelope_from_address;
+ if (!f && from && !from->next)
f = from;
if (f) {
args = add_option (args, &argslen, &argsmax, "-f");