Sending emails from the Linux terminal while preserving the fact of sending
2
votes
1
answer
95
views
I need to send a letter from Linux terminal to the recipient's mailing address. I want the fact of sending the letter, its title and its text to be saved in the sent section of my mailbox (the mailbox is administered by another company). It would be great if I didn't have to click to send them as in the script below.
Here is my previous solution, this method saves the attachments and forces me to click.
thunderbird -compose to="${mails}" ,subject="${sub}" ,body="${text}" ,attachment="'${attach},${letter}'";
Following the advice of the commenters, I configured mutt to use a mailbox. This is my first time using it, so maybe I did something wrong, but I was able to get a list of my emails on the server. Here is my .muttrc file (if you have any advice fot this file, please tell me):
# ======================= IMAP =========================
set imap_user = myaccount@company.com
set imap_pass = mypassword
set spoolfile = imaps://mail.company.com/INBOX
set folder = imaps://mail.company.com/
set record = "=SENDED"
set postponed = "=DRAFTS"
set mbox = "=INBOX"
#set header_cache = "~/.mutt/cache/headers"
#set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
# ======================= SMTP =========================
set smtp_url = "smtp://myaccount@company.com@mail.company.com:123/"
set smtp_pass = $imap_pass
set ssl_force_tls = yes
# ======================= Composition ==================
set editor = "nano"
set edit_headers = yes
set charset = UTF8
unset use_domain
set realname = "My Name"
set from = "myaccount@mail.company.com"
set use_from = yes
In any case, authorization on the server was successful and I received a list of my letters in the terminal.
Command to sending mails with attachments is: mutt -s "This is Subject" -a a.txt -- yipsokikko@gufum.com < test.txt
Asked by Nikulok
(33 rep)
Jul 10, 2025, 05:43 PM
Last activity: Jul 11, 2025, 07:17 PM
Last activity: Jul 11, 2025, 07:17 PM