Previously, having the envlope from address as part of the Message-ID causes
rspamd to generate a SPAM point (for unknown reasons).
Now, the local part of the envelope from address is never part of the Message-ID,
and there is limited configurability of the domain part of the Message-ID.
The logic prevented the envelope-from address to be taken from different
configuration file accounts (via inheritance, e.g. 'account default :
example'). However, the allow_from_override must only prevent taking the
envelope-from address from the --from option of the command line.
This fixes the second half of github issue #119
To fix this bug, I created a new function called log_later(). I
also considered moving the function definition for log() to before the
variable declarations, moving the variable declarations to underneath
the function declarations and moving the “"$MSMTP" --version” to the
script’s “entry point”. In the end I decided to create log_later() in
order to stay consistent with how the script was already written.
Fixes#93.
The problem was that there was a line of code that didn’t quote $MSMTP,
so for consistency, I decided to make sure that every use of the MSMTP
variable was quoted (even if the quotes weren’t necessary).
Fixes#92.
Reported, analyzed and fixed by Michaël Cadilhac for POP3/mpop;
according example SMTP sessions in the Microsoft documentation, this
also applies to SMTP.
8139cf6 (msmtpq: inherit MSMTP, Q and LOG from environment, 2022-08-06)
allowed the Q variable to be set from outside of the msmtpq script.
Before that change, Q was a reasonable name for that variable. Now that
that variable is sharing a namespace with the rest of the system, its
name should reflect the fact that it’s specific to the msmtpq script.
At the time of writing, there’s one release of msmtp (1.8.22) that
contains the changes from 8139cf6 (msmtpq: inherit MSMTP, Q and LOG from
environment, 2022-08-06). For backwards compatibility with that release,
this change makes the Q variable a deprecated alias of MSMTPQ_Q.
I used these scripts [1] to help me test the changes in this commit.
Thanks to Peter Hoeg for suggesting this change [2].
[1]: <https://gist.github.com/Jayman2000/09685f52f3a27450cd65391048b5dd53>
[2]: <https://github.com/marlam/msmtp-mirror/pull/86#discussion_r940283008>
I also decided to quote some variable expansions that didn’t need to be
quoted but just happened to be on some of the lines that I modified in
this commit. I want to set a precedent: quote your variables unless
there’s a reason not to.
Fixes#87.
Before this change, msmtpq would only make sure that $MSMTP was valid if
the user had customized it. Even if MSMTP is left at its default value,
it’s still a good idea to make sure that the default value is valid.
This change was suggested by Peter Hoeg:
<https://github.com/marlam/msmtp-mirror/pull/86#issuecomment-1208742887>
When I first tried to use msmtpq, I was a little bit confused by the
behavior of the Q and LOG variables. README.msmtpq does say that the
directories for those variables should be created before you run msmtpq,
but I didn’t notice that when I was first skimming through it.
This change makes msmtpq more resilient in those situations. Now, msmtpq
will not only create a directory for $Q and a directory for $LOG but
also create parent directories for those directories if necessary.
This change was inspired by a patch that was included in a nixpkgs PR:
<f8e3437ef2 (diff-db16f24325854530247bb84d212795a677d9477a0507fb9aa174f561653c5138R12)>
When a user is installing msmtpq simply by copying it to a location on
their PATH, it it perfectly reasonable to ask the user to edit msmtpq
before using it. However, when installing msmtpq via a package manager,
editing the msmtpq executable itself is not a good idea. In general,
files installed by a package manager should only be modified by that
package manager (unless the file is a configuration file).
Additionally, recommending that users to edit a script before it is used
creates friction when the script is updated. Every time the script is
updated, the user has to make those same changes again.
This change allows (and even encourages) the user to set the MSMTP, Q
and LOG variables from outside of the script. This allows users to
configure the location of the msmtp executable, msmtpq’s queue directory
and msmtpq’s log without modifying msmtpq itself.
This change was inspired by a patch that was included in a nixpkgs PR:
<f8e3437ef2 (diff-db16f24325854530247bb84d212795a677d9477a0507fb9aa174f561653c5138R11)>
716e47e (New version of msmtpq script, 2013-02-14) added the
connect_test() function. By setting EMAIL_CONN_TEST, the user could
select how connect_test() would check for a working Internet connection.
If the user didn’t specify EMAIL_CONN_TEST, then connect_test() would
use ping by default.
0f794b7 (Update msmtpq scripts., 2015-03-12) added a line that sets
EMAIL_CONN_TEST to “n”. This means two things:
1. The default connection test is no longer the one that uses ping, but
the comments in connect_test() still say that it’s the default.
2. The only way to switch to a different connection test is to edit the
msmtpq script itself.
Considering the number of changes in that commit and its brief commit
message, it seems like that change was unintentional.
This commit makes the connection test that uses ping the default again
and allows users to choose a different test without modifying the msmtpq
script itself.
When a socket name is given, the host name may be NULL, which was not yet
accepted everywhere and lead to a null pointer dereference (i.e. crash) in a
strlen() call when logging was active.
In addition to this strlen() call, several printf() calls were fixed, although
these just printed '(null)' instead of dereferencing the pointer.
Reportes as Github issue 79:
https://github.com/marlam/msmtp-mirror/issues/79