Application Octet Stream Filename
Print(yagmail.version) shows: 0.10.209 but I'm still getting the same results. Yes it works on gmail web client. The issue has something to do with the mac Mail App (desktop & ios) If you have macOS or iPhone when you will see that the csv attachments are displayed inline. See the part of the raw source, email send via perl's MIME::Lite + Net:SMTP, which works: Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename='123ARIADNA-10-2017.csv' Content-Type: application/octet-stream based on my research adding Content-Disposition: attachment with Content-Type: application/csv should work in the meantime a small amendment in sender.py did the trick;) if contentobject'encoding'!= 'base64' or contentobject'subtype' 'csv': contentobject'maintype' = 'application' contentobject'subtype' = 'octet-stream'.
The file name 1 is generated by browser. Browser that if a file is already available at same location lokeshkjain is right but it can be caused by something other than returning a filename which already exists. IE in particular does many things with the returned bytes from a Web server.
And JSP pages return blank lines at the top of a file unless great care is taken to remove them in the JSP page. Usually the initial blank lines occur before the directive that says that the content-disposition is octet-stream.
That can cause IE to redirect the stream to a new file, with the (1) in the file name. Also, octet-stream is not what a.csv file is, so some versions of IE see the change from octet-stream to csv (which should be either text, csv, or vnd.ms-excel) and redirect the stream to a different file - again with the (1) in the file name. If you are testing with the same file name over and over, the temporary area in which IE stores the file has the name, and IE adds the (1) (or (n) as you do more tests) to distinguish this temporary file from all the previous ones. If you want to be sure that you are testing the problem of a new file name getting the (1) added to it, add a unique string to every file name, like a timestamp. If you use a servlet rather than JSP, then the initial blank lines are not sent. However, the mime-type problems still occur. The only way to be absolutely sure for all versions of IE that IE will serve the file with the name you give it is to save the file locally on the server, and redirect IE to get the actual file on the server.
Application/octet-stream Filename
This all tends not to be a problem with Firefox, by the way.