pgiusto
asked on
Problem attaching PDF file using SMTP
I have an e-mail client written in C++. I wrote it some years ago, using plain SMTP messages through sockets.
Now I have to attach some PDF files to the message, so I learned all about the MIME thing. It works fine with text files, but I have problems with PDF files.
This are the headers I put on my message:
Mime-Version: 1.0
Content-Type: application/octet-stream; name=xx.pdf
Content-Disposition: attachment; filename=xx.pdf
Next I read the xx.pdf file using fread and send it through the socket.
The message goes to the server and is received by the recipient ok.
When the recipient opens the file (with Acrobat Reader) the file is corrupt. Before each byte with value 0A, "someone" inserted an extra byte with value 0D.
I think the problem is on the message headers, but I can't figure it out.
Now I have to attach some PDF files to the message, so I learned all about the MIME thing. It works fine with text files, but I have problems with PDF files.
This are the headers I put on my message:
Mime-Version: 1.0
Content-Type: application/octet-stream; name=xx.pdf
Content-Disposition: attachment; filename=xx.pdf
Next I read the xx.pdf file using fread and send it through the socket.
The message goes to the server and is received by the recipient ok.
When the recipient opens the file (with Acrobat Reader) the file is corrupt. Before each byte with value 0A, "someone" inserted an extra byte with value 0D.
I think the problem is on the message headers, but I can't figure it out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of omb.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.
Netminder
Community Support Moderator
Experts Exchange
DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.
Netminder
Community Support Moderator
Experts Exchange
Force/accepted by
Netminder
Community Support Moderator
Experts Exchange
Netminder
Community Support Moderator
Experts Exchange
Some of these questions have been open for some time. Please resolve them appropriately as soon as possible.
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20102194
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20165247
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193734
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20194470
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20247402
Thanks,
Netminder
Community Support Moderator
Experts Exchange