ciao!
devo inviare delle email con del CSS ben preciso.
per l'invio delle email uso phpmailer, mandandole con la funzione MsgHTML, che mi assicura di inviarle in formato HTML.
il testo che invio è una cosa del genere:
Codice PHP:
$html = <<<HTML
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<title>Ordine</title>
<style>
.table-bordered { border: 1px solid #DDD; }
.table { width: 100%;max-width: 100%;margin-bottom: 20px; }
table { background-color: transparent; }
table { border-spacing: 0px;border-collapse: collapse; }
.table > caption + thead > tr:first-child > td, .table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > td, .table > thead:first-child > tr:first-child > th { border-top: 0px none; }
table.table-bordered thead th, table.table-bordered thead td { border-left-width: 0px;border-top-width: 0px; }
.table-bordered > thead > tr > td, .table-bordered > thead > tr > th { border-bottom-width: 2px; }
.table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > td,
.table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > thead > tr > th { border: 1px solid #DDD; }
.table > thead > tr > th { vertical-align: bottom;border-bottom: 2px solid #DDD; }
.table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th,
.table > thead > tr > td, .table > thead > tr > th { padding: 8px;line-height: 1.42857;vertical-align: top;border-top: 1px solid #DDD; }
th { text-align: left; }
</style>
</head>
<body>
$table
<hr><br>
<table class="table table-bordered" style="width: 250px;">
<tr>
<td>Tot Qta</td>
<td>Tot Imp</td>
</tr>
<tr>
<td>$qtaTotale</td>
<td>$importoTotale</td>
</tr>
</table>
<br><hr><br>
$note
</body>
</html>
HTML;
dove $table è una table html che delle classi per impostare il css.
ma l'email arriva senza css, e se vado a vedere, i vari cass vengono levati.
come posso fare?
o meglio, dove sto sbagliando??