Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msmtpq not respecting EMAIL_CONN_TEST #120

Open
KarlJoad opened this issue Apr 24, 2023 · 3 comments
Open

msmtpq not respecting EMAIL_CONN_TEST #120

KarlJoad opened this issue Apr 24, 2023 · 3 comments

Comments

@KarlJoad
Copy link

While building a home environment with Guix, I am generating some environment variables for use with msmtpq in combination with mu4e. Normal sending with msmtp is currently working perfectly. But when I try to use msmtpq, it does not seem to be respecting the EMAIL_CONN_TEST or the EMAIL_CONN_NOTEST environment variables. (I know that EMAIL_CONN_NOTEST is being deprecated, but I am trying to cover as many bases as possible.)

I have it narrowed down and it appears to be reproducible.

declare -x EMAIL_CONN_NOTEST="y"
declare -x EMAIL_CONN_TEST="x"
declare -x GUIX_EXTENSIONS_PATH="/home/karljoad/.guix-home/profile/share/guix/extensions:/home/karljoad/.guix-home/profile/share/guix/extensions"
declare -x LANGUAGE="en_US.utf8"
declare -x LC_ALL="en_US.utf8"
declare -x MANPATH="/home/karljoad/.guix-home/profile/share/man:"
declare -x MSMTPQ_LOG="/home/karljoad/.local/var/log/msmtpq.log"
declare -x MSMTPQ_Q="/home/karljoad/.msmtpqueue"
declare -x NIX_PROFILE="/home/karljoad/.nix-profile"
declare -x OLDPWD
declare -x PATH="/home/karljoad/.nix-profile/bin:/home/karljoad/.guix-home/profile/bin:/home/karljoad/.guix-home/profile/sbin:/home/karljoad/.nix-profile/bin:/home/karljoad/.guix-home/profile/bin:/home/karljoad/.guix-home/profile/sbin:/home/karljoad/.nix-profile/bin:/gnu/store/bpccg95yzqkpcnbkkrgw4gx33a6wpyk7-home-system-profile/bin"
declare -x PWD="/home/karljoad"
declare -x QUEUEDIR="/home/karljoad/.msmtpqueue"
declare -x SHELL="/gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin/bash"
declare -x SQLITE_HISTORY="/home/karljoad/.cache/sqlite_history"
declare -x XDG_CACHE_HOME="/home/karljoad/.cache"
declare -x XDG_CONFIG_DIRS="/home/karljoad/.guix-home/profile/etc:/home/karljoad/.guix-home/profile/etc:/home/karljoad/.guix-home/profile/etc/xdg:"
declare -x XDG_CONFIG_HOME="/home/karljoad/.config"
declare -x XDG_DATA_DIRS="/home/karljoad/.guix-home/profile/share:/home/karljoad/.guix-home/profile/share:/home/karljoad/.guix-home/profile/share:"
declare -x XDG_DATA_HOME="/home/karljoad/.local/share"
declare -x XDG_LOG_HOME="/home/karljoad/.local/var/log"
declare -x XDG_RUNTIME_DIR="/run/user/1000"
declare -x XDG_STATE_HOME="/home/karljoad/.local/var/lib"

I can even verify that the environment variables are set correctly with the following bash snippet.
These tests are quite similar to the ones that are done in msmtpq, so I do not understand why things are not behaving as I expect.

$ [ "$EMAIL_CONN_TEST" != 'x' ] && echo "connect" || echo "queue"
queue
$ [ -z "$EMAIL_CONN_NOTEST" ] && echo "connect" || echo "queue"
queue

But no matter what I do, I always get

$ msmtpq -oi --read-envelope-from 'Karl <[email protected]>' < queue-test.mail
/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
  mail for [ -oi --read-envelope-from Karl <[email protected]> ] : send was successful

The locale issues are being raised because I am running the commands inside a container which has only the files I need (namely the msmtp configuration file, the certs, my secrets, etc.), files I explicitly specify (the mail file), and a network connection. This means the locale files are not present, which should not be an issue anyways. I can send emails normally inside the container with the following snippet.

$ msmtp -oi --read-envelope-from 'Karl <[email protected]>' < queue-test.mail
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

I cannot narrow down why this would be happening. Any advice?

@Jayman2000
Copy link
Contributor

I don’t fully understand what the problem is.

But when I try to use msmtpq, it does not seem to be respecting the
EMAIL_CONN_TEST or the EMAIL_CONN_NOTEST environment variables.

How do you know that msmtpq isn’t respecting those variables? Later on in the post, you said you did this:

$ msmtpq -oi --read-envelope-from 'Karl <[email protected]>' < queue-test.mail
/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
  mail for [ -oi --read-envelope-from Karl <[email protected]> ] : send was successful

But that doesn’t show whether or not the connection test was run.


What happens is you try to run msmtpq without a working Internet connection? When I disconnect and run msmtpq with EMAIL_CONN_TEST=p, here’s what I get

  mail for [ [email protected] ] : couldn't be sent - host not connected
  enqueued mail as : [ 2023-09-04-15.30.27 ] ( [email protected] ) : successful

When I disconnect and run msmtpq with EMAIL_CONN_TEST=x, here’s what I get:

msmtp: cannot locate host box.jasonyundt.email: Name or service not known
msmtp: could not send mail (account default from /home/jayman/.msmtprc)
  mail for [ [email protected] ] : send was unsuccessful ; msmtp exit code was 68
  enqueued mail as : [ 2023-09-04-15.33.31 ] ( [email protected] )

When EMAIL_CONN_TEST is set to p, I get an error message from msmtpq itself. When EMAIL_CONN_TEST is set to x, I get an error message from msmtp.


But no matter what I do, I always get

$ msmtpq -oi --read-envelope-from 'Karl <[email protected]>' < queue-test.mail
/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
  mail for [ -oi --read-envelope-from Karl <[email protected]> ] : send was successful

It’s not clear to me why that’s a problem. It says that the send was
successful. Are you expecting it to not be successful sometimes?

@balejk
Copy link

balejk commented Apr 9, 2024

@KarlJoad Is this still a problem? Have you tried looking into Jayman2000's suggestions?

@KarlJoad
Copy link
Author

KarlJoad commented Apr 9, 2024

Sorry. This fell on my backburner. I will need to test everything again. From my recollection, I was deliberately trying to force an email to be queued, even if there was an Internet connection. But I forget what I was doing exactly.

I will need to figure out what was going on and what behavior I wanted/expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants