From 4b0725144f954e9a40c70289e5456401d58759f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 17 Sep 2008 16:51:30 +0000 Subject: Option to disable Message-ID header (Phil Sutter). --- NEWS | 2 ++ esmtprc.5 | 9 +++++++++ lexer.l | 1 + parser.y | 4 +++- smtp.c | 5 +++++ smtp.h | 1 + 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 70dd471..809c2e0 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ News * 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. diff --git a/esmtprc.5 b/esmtprc.5 index 6fd7741..b0bcbd9 100644 --- a/esmtprc.5 +++ b/esmtprc.5 @@ -91,6 +91,15 @@ Set the envelope from address. The address given to -f will only be used as "From:" when the message contains none. "%u" will be replaced with the username. "%%" by "%". +.TP +\fBmessage_id\fR +Whether to set the Message-ID field of the message before sending. +Normally the receiving MTA sets the Message-ID if missing, so you can turn +this off if your sending host does not have a fully qualified domain name. + +Allowed values are either \fBenabled\fR or \fBdisabled\fR. It defaults to +\fBenabled\fR + .TP \fBpreconnect\fR Shell command to execute prior to opening an SMTP connection. diff --git a/lexer.l b/lexer.l index bf1ffff..668837f 100644 --- a/lexer.l +++ b/lexer.l @@ -67,6 +67,7 @@ helo { return HELO; } force { return FORCE; } reverse_path { return REVERSE_PATH; } sender { return SENDER; } +message_id { return MSGID; } mda { return MDA; } = { return MAP; } diff --git a/parser.y b/parser.y index 0382014..bc01fb7 100644 --- a/parser.y +++ b/parser.y @@ -64,7 +64,7 @@ void yyerror (const char *s); char *sval; } -%token IDENTITY DEFAULT HOSTNAME USERNAME PASSWORD STARTTLS CERTIFICATE_PASSPHRASE PRECONNECT POSTCONNECT MDA QUALIFYDOMAIN HELO FORCE SENDER REVERSE_PATH +%token IDENTITY DEFAULT HOSTNAME USERNAME PASSWORD STARTTLS CERTIFICATE_PASSPHRASE PRECONNECT POSTCONNECT MDA QUALIFYDOMAIN HELO FORCE SENDER MSGID REVERSE_PATH %token MAP @@ -116,6 +116,8 @@ statement : HOSTNAME map STRING { identity->host = xstrdup($3); SET_DEFAULT_IDEN | HELO map STRING { identity->helo = xstrdup($3); SET_DEFAULT_IDENTITY; } | FORCE REVERSE_PATH map STRING { identity->force_reverse_path = xstrdup($4); SET_DEFAULT_IDENTITY; } | FORCE SENDER map STRING { identity->force_sender = xstrdup($4); SET_DEFAULT_IDENTITY; } + | MSGID map DISABLED { identity->prohibit_msgid = 1; SET_DEFAULT_IDENTITY; } + | MSGID map ENABLED { identity->prohibit_msgid = 0; SET_DEFAULT_IDENTITY; } | MDA map STRING { mda = xstrdup($3); } | DEFAULT { default_identity = identity; } ; diff --git a/smtp.c b/smtp.c index da259ea..796578d 100644 --- a/smtp.c +++ b/smtp.c @@ -650,6 +650,11 @@ void smtp_send(message_t *msg, identity_t *identity) goto failure; } + /* Prohibit Message-ID:-Header if force_msgid is not specified */ + if(identity->prohibit_msgid) + if(!smtp_set_header_option(message, "Message-ID", Hdr_PROHIBIT, (int)1)) + goto failure; + /* DSN options */ if(!smtp_dsn_set_ret(message, msg->ret)) goto failure; diff --git a/smtp.h b/smtp.h index 0e2909d..8b2e754 100644 --- a/smtp.h +++ b/smtp.h @@ -53,6 +53,7 @@ typedef struct { /*@{*/ char *force_reverse_path; char *force_sender; + int prohibit_msgid; /*@}*/ } identity_t; -- cgit v1.2.3