muquit / mailsend

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

Attachment not sent #85

Open luca7766 opened 8 years ago

luca7766 commented 8 years ago

I used -attach "filename.pdf" but into the email there's no attachment, here's the full command:

mailsend.exe -smtp out.myserver.com -f myaddress@ -t destination@ -sub "Testing" -mime-type "text/plain" -msg-body "C:\message.txt" -attach "c:\filename.pdf"

Tried even adding -mime-type "application/pdf" Tried even with gmail SMTP, mail send and received but with no attachments. Am I doing something wrong? Thank you.

muquit commented 8 years ago

-msg-body option is special, it can not be used with -attach. If you want the text file to be embedded, you can try to attach it as inline. FAQ#1 talks about it.

Thanks.

luca7766 commented 8 years ago

Ok, i get it, so to send a text as mail body I should use:

-attach "textfile.txt","text/plain",i

and for a textfile plus a pdf attachment:

-attach "textfile.txt","text/plain",i -attach "document.pdf","application/pdf",a

I tried, but both solutions keep the attachment inside the source of the message, i can't see the clip of the pdf file for saving it and the text file is blank, but both files are sent, tested in thunderbird and webmail. Am I wrong again? Thanks

muquit commented 8 years ago

No, all the parameters must be inside quotes like -enctype "none" -attach "textfile.txt,text/plain,i" -enc-type "base64" -attach "document.pdf,application/pdf,a"

Or it can be more verbose, e.g.

-mime-type "text/plain" -enc-type "none" -disposition "inline" -attach "textfile.txt" -mime-type "application/pdf" -enc-type "base64" -disposition "attachment" -attach "document.pdf"

Each of the parameters overwrite the previous attachment's parameters. It's a good idea a clearly specify the parameters for each attachments, otherwise previous attachment's parameter will be used, which may or may not be appropriate.

Thanks.

luca7766 commented 8 years ago

Tried with: -mime-type "text/plain" -enc-type "none" -disposition "inline" -attach "textfile.txt" and -enc-type "none" -attach "textfile.txt,text/plain,i" with no success, mail is sent and received but the text is not visibile, neither as attachment, but you can read it by viewing mail source under the lines:

Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

Same for the pdf attachment, am I wrong again? Thanks

muquit commented 8 years ago

I tested with gmail and outlook, text file shows up as inline and pdf as attachment. Can you send a sample mail to muquit@gmail.com?

Thanks.

luca7766 commented 8 years ago

I just sent you a "Testing" message, the sender email is not real, but the issues happen even with my real email address. I attached an inline txt file and a pdf as attachment using: mailsend.exe -smtp out.alice.it -f email@email.com -t muquit@gmail.com -sub "Testing" -enc-type "none" -attach "C:\Users\Administrator\Desktop\testfile.txt,text/plain,i" -enc-type "base64" -attach "C:\Users\Administrator\Desktop\Document.pdf,application/pdf,a"

Tried even using gmail SMTP with proper auth

muquit commented 8 years ago

I've to look at it over the weekends. I'm sure I tested sending mails from windows before releasing 1.18.

Thanks.

luca7766 commented 8 years ago

It's ok, thanks, not urgent, just figuring it out if it's me doing mistakes, thank you.

cinghiuz commented 8 years ago

I just got a problem similar to this one: with mailsend1.16.exe the attachemnt arrive fine, with 1.17b15 or 1.18 it doesn't. One particular thing is that I've got a mail without body, just the attachment.

Thank you for your support.

JimBobele commented 8 years ago

Hi,

same problem here. Seems to be a Kombination of mailsend versions and the provider one is using. Or maybe the difference between SSL and TLS. Have a look at the following 4 examples. The first one uses ms1.19 and hotmail and works fine, text and attachment OK. The second one uses ms1.19 and gmx and fails, no text and no attachment are part of the mail. Nevertheless the third one uses ms1.16 and everything works fine. This menas to me it's not really an issue of the provider. in the fourth case I removed the text, only a pdf should be attached, ms1.19 with GMX. In this case the attachment is sent but it is corrupted and cannot be read.

Hotmail uses TLS and GMX SSL Hope this helps.

Regards Reiner

1. mailsend1.19.exe -to XXXXXX -f XXXXXX@hotmail.com -smtp smtp-mail.outlook.com -port 587 -starttls -auth -user XXXXXX@hotmail.com -pass XXXXXX -sub "Mailsend 1.19 HOTMAIL" -cs "windows-1252" -attach "test.txt,text/html,i" -attach "test.pdf"

2. mailsend1.19.exe -to XXXXXX -f XXXXXX@gmx.de -smtp mail.gmx.net -port 465 -ssl -auth -user XXXXXX@gmx.de -pass XXXXXX -sub "Mailsend 1.19 GMX" -cs "windows-1252" -attach "test.txt,text/html,i" -attach "test.pdf"

3. mailsend1.16.exe -to XXXXXX -f XXXXXX@gmx.de -smtp mail.gmx.net -port 465 -ssl -auth -user XXXXXX@gmx.de -pass XXXXXX -sub "Mailsend 1.16 GMX" -cs "windows-1252" -attach "test.txt,text/html,i" -attach "test.pdf"

4. mailsend1.19.exe -to XXXXXX -f XXXXXX@gmx.de -smtp mail.gmx.net -port 465 -ssl -auth -user XXXXXX@gmx.de -pass XXXXXX -sub "Mailsend 1.19 GMX No text" -cs "windows-1252" -attach "test.pdf"