Send emails via terminal

Hello. I would like to send emails via terminal programmically. How do to it? I have an Outlook email.

I have installed mutt. I think it would allow to do it.

  1. Can I use mutt without SplitGPG? From the quidelines it is unclear: “Mutt generally works out of the box. This configuration guide discusses only Qubes-specific setup. In this example we will have one TemplateVM and several AppVMs. It also takes advantage of SplitGPG, which is assumed to be already working.”

  2. Currently, then I type “$ mutt “test title” user@gmail.com” the email is not being sent right away.

There’s nothing Qubes specific here - like many problems in Qubes you can solve
it just by looking for a solution for the distribution you are using in
the template.

Mutt is primarily a mail agent - you can use it at the command line,
or you can use mail, or some other application that will send
mail.

  1. You can use mutt without SplitGPG.
  2. If you want to send mail programmatically, you want something like:
    mail -s "test title" user@gmail.com <<< 'Body'
    or echo Body |mail -s "test title" user@gmail.com
    If the message is in a file, then you can access it like this:
    ` cat Body |mail -s “test title” user@gmail.com ``

You will need to ensure that your mail sender program is configured
properly - the details of this will depend on your SMTP settings.
As I say there is nothing Qubes specific.

1 Like

Hello. I installed the package via “$ sudo dnf install mailx”.

I have updated the configuration file ssmtp.conf:

root=mymail@outlook.com
mailhub:587=smtp.outlook365.com
AuthUser=mymail@outlook.com
AuthPass=mypass
AuthMethod=LOGIN
#UseSTARTTLS=YES
UseTLS=YES

Then I run the command “$ echo Body |mail -s “test title” user@gmail.com,
no email is being sent with the timeout error “send-mail: Cannot open smtp.outlook365.com:587

My guess that maybe there are some firewalling QubesOS rules that prevent the mail from being sent? I use the default firewall rules.

Question: how to fix it?