Reputation: 3222
I am trying to send email from Perl script using sendmail
command.
Email contains a attachment (.txt file).
Here is the command I have tried:
>:/usr/people/vkk > echo "Subject:Report" | sendmail -t [email protected] < "/usr/people/vkk/Downloads/report_daily_2022_08_24_19_30_17.txt"
Ambiguous input redirect.
When I add echo "Subject:Report"
option it gives following message -
Ambiguous input redirect
What is the right syntax to send an email with an attachment and subject line using sendmail
command.
Upvotes: 0
Views: 3581
Reputation: 21
It is not a good idea to send an attachment using sendmail command because you have to encoded the attachment by uuencode. So it is better to use mail or mutt command to sending attachment. Below command is the example for mail command.
Install mail command in Centos/RHEL
Install mail command on Ubuntu/Debian/LinuxMint
Upvotes: 2