I use the mailprogram and wonder if I delete mails within the program if they are also deleted incl attachments and all. Or is there another file where mails should be deleted in order to free up space?
Create a new mailbox, but set it as one that's on the Mac. This is essentially a folder on your computer, although it shows up in mail as a Mailbox.
Any mail you want to keep, put it in there and everything will be saved on your hard drive. Anything you don't want to keep, just delete.
This allows you to free up space on your mail server without losing the messages or attachments. It also protects your files if something happens to the mail server or you can't connect to the internet for some reason.
If you're looking to save a little space, you could keep the text content of messages that are in one of your locally saved mailboxes, but remove the attachments if they're no longer needed. Select message(s) that have attachment icons, go to menu>Message>Remove Attachments.