php – Missing css classes in emails


There is a mailing list layout. All css styles are written in the body of the mailing document. All styles are attached to html tags using classes.

Sending an email using mail(), PHP. We see in the mail (,, a letter without styles. And there are not even css classes, there are only tags.

And if you also open a letter in Thunderbird, for example, then all classes are there and the letter looks beautiful.

I tried moving styles, compressing styles, changing class quotes from double to single, reading the mailing text from a file and inserting it directly into the php code.

Please tell me what is the problem. Thank you.


When laying out letters, it is recommended to write all styles inline.

That is, do not create selectors, classes, and so on, but write styles in the style tag

For instance:

<div style="background:red;">
Scroll to Top