Answer the question
In order to leave comments, you need to log in
How to set up sending mail with an attachment, where the name of the attachment always changes?
Please tell me how to implement.
I have a script that sends a message with an attachment
#!/bin/bash
for I in `cat list_adresses`; do cat body | mutt -e "set content_type=text/html" -a
"/path/to/directory/File_name_29.04.21" -s "Тема письма" -- $I < body;echo $I;sleep 1 ;done
Answer the question
In order to leave comments, you need to log in
In general, it's very simple to
make a variable
attach=$(ls /path/to/file/ | grep File_name)
AND put the variable in the attachment
-a "/path/to/file/$attach"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question