muquit / mailsend

A program to send mail via SMTP from command line
Other
294 stars 68 forks source link

-attach option doesn't work with -msg-body option #76

Closed cinghiuz closed 9 years ago

cinghiuz commented 9 years ago

Hi there!

First of all thank you for this great program!

My goal is to write an e-mail with a simple text of some lines in the body and attach a pdf file. I tested 1.17b15, but if I use -msg-body option, the attached file doesn't arrive at destination, while it arrives if I don't use -msg-body.

Is there a way to do this?

In Linux I used this trick: mailsend [...] -attach filename.pdf -M "cat body.txt"

and it works fine, but in Windows it isn't possible to use command substitution...

Thank you!!

Cesare

muquit commented 9 years ago

Yes -msg-body is used to include only one text file in the mail body, nothing else can be attached if this option is used.

Thanks.

cinghiuz commented 9 years ago

There is no way to create a body with some text lines, instead of just one line, and attach a pdf file?

Thank you for your prompt reply!

Cesare

muquit commented 9 years ago

You can use multiple lines -M "line1" -M "line2". Each line can have its own mime type, encoding, cs, that means each line can be in different languages. There is an example on FAQ. You can also look at the script test/test_gmail.sh for an example.

 -enc-type "none" \
 -mime-type "text/plain" \
 -M "one line attachment 1" \
 -enc-type "none" \
 -mime-type "text/plain" \
 -M "one line attachment 2" \
 -mime-type "text/html" \
 -enc-type "none" \
 -M "<b>this is a test</b><br>" \
 -cs "Big5" \
 -enc-type "base64" \
 -mime-type "text/plain" \
 -M "中文測試"

Thanks.

cinghiuz commented 9 years ago

Dear Muquit,

that solution is a bit tricky for my needs, but after some tests I found that with 1.17b15 works fine this command: mailsend [...] -attach /tmp/body.txt,text/plain,i -attach /tmp/myfile.pdf

I tested this solution both in Windows and in CentOS 6.5 and with and without ssl: it's perfect.

Thank you for your support!

Have a nice day!

Cesare