I don't know the legality of this in the EU but often it is required that you opt-in to these marketing emails to create an account or do other basic things on a website.
And then there's those online stores that cover the entire page in a popup that you can get a 20% discount code if you give your email. Technically I've opted into their marketing. But I always just use the coupon and then report the email as spam without bothering to unsubscribe.