Closed Poyias closed 4 years ago
I tried the one below, the email is succesfully being sent and only the txt file can open. The pdf files are corrupted: smtp_attachment_add_path(this->smtp, "test.pdf", "source\test.pdf"); smtp_attachment_add_path(this->smtp, "blah.txt", "source\blah.txt"); FILE *fp; fp = fopen("source\test.pdf", "r"); smtp_attachment_add_fp(this->smtp, "test.pdf", fp);
It looks like this issue only affects Windows. In your example, please change "r" to "rb" when opening the PDF file with fopen(). I also updated the path function to use rb.
Thanks for the quick reply. I tried your changes but I still see the same problem.
Problem solved. You were right, the only problem was "rb" in the end. Thanks a lot!!
Hi there,
This is a great smtp-client and thanks :) I have been trying to add .pdf attachments to the email. I am using this: smtp_attachment_add_path(this->smtp, "test.pdf", "source\test.pdf");
If I try to attach a ".txt" file it works great but doing it with a pdf the emails are being sent but the attached pdfs are corrupted and cannot open.
Thanks, Andreas