Email with smtp a pdf
Email with smtp a pdf
I have a working smtp setup for my program. What does not work is when I attach a pdf file it sends but it is unreadable as it is sent as plain text. I can't find a list of mime types and most notably the mime type to set in the smtp client for sending a pdf file. Any help?
Re: Email with smtp a pdf
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
Re: Email with smtp a pdf
application/pdf is what I already set the mime type to. Which is what your link suggests although not specifically for gambas. But I already have it as I thought it should be. I should have made it more clear. Below is the line doing the attachment.
e.Add(User.Home & "/" & StoreName & SlsID & ".pdf", "application/pdf", StoreName & SlsID & ".pdf")
it works but the mime type is not right as the file can't be opened on the other end.
e.Add(User.Home & "/" & StoreName & SlsID & ".pdf", "application/pdf", StoreName & SlsID & ".pdf")
it works but the mime type is not right as the file can't be opened on the other end.
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Email with smtp a pdf
I had a look at this and discovered (thanks to gbWilly) that you need to load the PDF file, and then it works as expected. Try the following:-
e.Add(File.Load(User.Home &/ StoreName & SlsID & ".pdf"), "application/pdf", StoreName & SlsID & ".pdf")
Note that &/ will add a slash, if it is needed. No need for & "/" & which will add a slash if it is needed or not.Re: Email with smtp a pdf
You are truly the god of gambas. I had a feeling it was something easy but I was looking in the wrong spot. Thank you for the help it is working perfectly now. This was for a Point of Sale that I developed and use written in gambas. Keep the great work up.
Re: Email with smtp a pdf
That's a very old post of mineI had a look at this and discovered (thanks to gbWilly) that you need to load the PDF file, and then it works as expected. Try the following:-
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributer
... there is always a Catch if things go wrong!
- Dutch translation for Gambas3
- Gambas wiki content contributer
... there is always a Catch if things go wrong!
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Email with smtp a pdf
Nice to know you are still around!That's a very old post of mine