I would like to send an email along with the attachment using sendmail
option with script.
I have received a mail successfully and got empty attachment.
Here, I am trying to attach a file called test.txt
and both the script and test.txt are present in the same location.
Am I missing anything here?
Below is the script I used for testing the mail functionality.
/usr/sbin/sendmail -t << EOT
To:[email protected]
Subject: Test
MIME-Version:1.0
Content-Type: multipart/mixed;boundary="ABC"
--ABC
Content-Type:text/plain
Content-Disposition:inline
Hello, sendmail Test!!!!
--ABC
Content-Type: text/plain
Content-Disposition: attachment ; filename="test.txt"
--ABC--
EOT
It is because you have not put the content of the attachment. Please try the code below:
/usr/sbin/sendmail -t << EOT
To:[email protected]
Subject: Test
MIME-Version:1.0
Content-Type: multipart/mixed;boundary="ABC"
--ABC
Content-Type:text/plain
Content-Disposition:inline
Hello, sendmail Test!!!!
--ABC
Content-Type: text/plain
Content-Transfer-Encoding: uuencode
Content-Disposition: attachment ; filename="test.txt"
`uuencode test.txt test.txt`
EOT