kruczkowski
kruczkowski

Reputation: 845

Script to mail multiple files as independant email attachments

I'm looking to mail several pdf's that are located in a single directory via the mail command. Each email should only contain one PDF file as an attachment.

Can you please provide a template on how to send each PDF via mail, one by one? Ideally Bash or AppleScript

Upvotes: 1

Views: 1074

Answers (1)

ghostdog74
ghostdog74

Reputation: 342591

you can use mutt or uuencode

recipient="[email protected]"
for file in *.pdf
do
    mutt -s "subject" -a "$file" $recipient < message.txt
    # uuencode "$file" "$file" | mail -s "subject" $recipient  #using uuencode
done

Upvotes: 2

Related Questions