Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 57220  / 2 Years ago, tue, june 7, 2022, 11:41:35

I have a shell script that uses sendmail function to send email the code is as follows



mailalert(){
sendmail -F Sender-Name -it <<END_MESSAGE
To: [email protected]
Subject: Subject

Message
END_MESSAGE
}


It gets executed whenever I call this function. Now I have a text file which I want to send using sendmail as attachment or as message in the email it sends. How can I do that? I have tried alot of tricks but nothing seems to work. Please Help.


More From » email

 Answers
2

Rather strange but I used a different approach as while using uuencode it started executing but the cursor stuck at begin 644 /path/to/file so I used cat to send my file in the message body.



file=/path/to/file
mailalert(){
sendmail -F Sender-Name -it <<END_MESSAGE
To: [email protected]
Subject: Subject

$(cat $file)
END_MESSAGE
}


The above code worked perfectly but when I saw the message in my web browser it was fine. But when I saw it in Thunderbird it was not shown correctly. It was like kind of encoded.



So, I'm keeping this question open until I dont find the right solution for now.


[#29106] Thursday, June 9, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aslity

Total Points: 336
Total Questions: 133
Total Answers: 98

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
;