2

I have a container from which I would like to be able to automatically send emails. I installed mutt in the container since it seems like a popular email client.

My .muttrc file looks like this:

# About Me
set from = "my@email.com"
set realname = "my name"

# My credentials
set smtp_url = "smtp://smtp.my-smtp.com:port#"
set ssl_verify_host = no
set ssl_verify_dates = no
set copy = no
# Where to put the stuff
set header_cache = "/opt/mutt/cache/headers"
set message_cachedir = "/opt/mutt/cache/bodies"
set certificate_file = "/opt/mutt/certificates"

If I start up mutt, I can send an email through the UI. However, I am prompted to accept my smtp server's certificate. The email then sends without problem.

The issue is, I want this to be an automatic process. I want to start the container, and then have a script run something like:

echo "" | mutt -s "subject" -i "body.txt" someone@email.com

When I do that, the email is not sent. I do not see any errors and do not see any logs under /var/logs.

If I go through the UI and accept the certificate, I may then send emails from the command line. I do not want to manually go through the UI, though.

Is there a way to automatically accept certificates from the command line? Is there a better approach to what I am trying to do?

mattalex
  • 41
  • 2

1 Answers1

1

I was able to get a cert outside of mutt and placed it in mutt's certificates file. That solved the issue for me.

mattalex
  • 41
  • 2
  • For those wondering, the certificates are stored in `~/.mutt_certificates`. Once it is generated you can reuse the file for later automation. – Matthieu Aug 23 '23 at 14:16