How to send mail tar.gz has attachment using cygwin?

Hi

I am using cygwin in windows i need to send mail has attachment which was in tar.gz format

i was using this command to send mail. I can able to send mail but attachment was not happening

Is there any free email client to send mail has attachment which support tar file using cygwin shell script

Command used

mailsend -f from@dummy.com -smtp 10.0.0.1 -t TO@dummy.com -sub "Test mail" -attach "D:\cygwin\home\test.tar.gz" 

From the instructions for mailsend, -attach file,mime_type,[i/a] (i=inline,a=attachment)

So -attach "D:\cygwin\home\test.tar.gz,application/tar-gz,a"

1 Like

Thanks it was working i can send tar has attachment.

I have another issue but till now i can able to resolve

I was using same mailsend to send attachment and add body txt. But adding the text to the BODY was not working for me. Please let me know you have any solucation for this

1 Like

Show exactly what you did please.

I was using this code

mailsend -f from@dummy.com -smtp 10.0.0.1 -t TO@dummy.com -sub "Test mail" -msg-body "D:\cygwin\home\body ,text/plain" -attach "D:\cygwin\home\attachment.csv ,text/plain" 

The message body does not require ",text/plain". The message body should just be a path to a filename containing text.

If i use msg-body attachment was not coming

mailsend -f from@dummy.com -smtp 10.0.0.1 -t TO@dummy.com -sub "Test mail" -msg-body "D:\cygwin\home\body" -attach "D:\cygwin\home\attachment.csv ,text/plain"

Run ls -l "D:\cygwin\home\body" and show the output please.

Also, what kind of file is D:\cygwin\home\body ? Windows text or UNIX text?

I am using cywin so it will be unix format plain text file. I can able to send Body message in mail. If use body, tar attached was not coming at a time any one was working.

I can either do attachment or body

That you're using cygwin is what makes me suspect it's not.

In any case, I still want the output of ls -l

Pls find the ls -ltr image

Pasteboard - Uploaded Image

You changed it. Run this exact command word-for-word, letter-for-letter, keystroke-for-keystroke.
ls -l "D:\cygwin\home\body"

Sorry from Cywin windows path will not work. But for mailsend it use the windows path

Pasteboard - Uploaded Image

Pasteboard - Uploaded Image

Try the UNIX path anyway. Also try doubling up the Windows path like d:\\path\\to\\file.

Why are you posting images of text?

You could also try cygpath eg:

$ mailsend -f from@dummy.com -smtp 10.0.0.1 -t TO@dummy.com -sub "Test mail" -attach $(cygpath "D:\cygwin\home\test.tar.gz")

Buy default i can able to send attachment. But if i want to add body attachment was missing