Вопрос

I´m trying to send an email in php using my web fonts on the body of the email text.

I have this link for my web fonts.

  <link rel="stylesheet" type="text/css" href="http://localhost/projet/tpl/fonts/fonts.css" />

Then I have a message that I want to send using my fonts in the text:

$msg = '<h3 style="font-family: \'bariol_boldbold\'; color:#099;">Hello '.$assoc['name'].', </h3>
<p style="font:bold 12px Arial, Helvetica, sans-serif; color:#666;">How are ayou?</p>';

My bariol_boldbold is a webfont that I have and its not working,but with Arial, Helvetica, sans-serif its working.

To send emails with web fonts can not be this way \'bariol_boldbold\'?

I

Это было полезно?

Решение

<link rel="stylesheet" type="text/css" href="http://localhost/projet/tpl/fonts/fonts.css" /> 

What you have here attempts to access a file from your local computer (localhost), it isn't working because how can gmail access a file on your computer? they can't!

You would need something like this:

<link rel="stylesheet" type="text/css" href="http://my-website.com/projet/tpl/fonts/fonts.css" /> 

Другие советы

Webfonts in html email are not very straight forward I'm afraid. They are unsupported in several clients, and Outlook '07, '10 and '13 will actually revert to times new roman if you try to use them there. You need to use conditional statements to avoid this.

See this thread for the most well supported technique I could find. It works in all email clients that accept web-fonts and falls back gracefully to sans-serif on other clients.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top