Email with smtp a pdf

Post

Posted
Rating:
#1 (In Topic #696)
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
 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?
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’

sadams54 said

… the mime type to set in the smtp client for sending a pdf file.

…maybe:  :|

  http headers - Proper MIME media type for PDF files - Stack Overflow
  mime application/pdf

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
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:-

Code (gambas)

  1. 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.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
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.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
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:-

That's a very old post of mine ;)

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Guru
cogier is in the usergroup ‘Guru’
That's a very old post of mine

Nice to know you are still around!
Online now: No Back to the top
1 guest and 0 members have just viewed this.