Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change font in phpmailer?

Tags:

php

phpmailer

I'm planning to send an email with a font style of "century gothic" when received. I hope somebody can help me with my problem. I'm very thankful for your answers.

this is my code

$mail->Body = "

            <html>
                <head></head>
            <body>
                <b>Request ID:</b> $bodystring <br>
                <b>Type:</b> $bodystring1 <br>
                <b>Request:</b> $bodystring2 <br>
                <b>Status:</b> $bodystring3 <br>
                <b>Service:</b> $bodystring4 <br>
                <b>Request Date:</b> $bodystring5 <br>
                <b>Target Date:</b> $bodystring6 <br>
            </body>
";
like image 632
Jason Balaoing Avatar asked Mar 16 '23 07:03

Jason Balaoing


1 Answers

HTML email stylings is a minefield of issues, you basically need to revert back to HTML version 4.0 and style everything with inline <font > tags. You will also need to add font as a <style> body{ }</style> tag as well above the <body> tags of your email. There is a lot of reading material on the interet about this as it's a pain in the bum to make cross platform and cross system support. It still uses old tags and keeping as much styling inline as possible is the way. Do not bother calling outside style sheets they'll be dropped by the mailreader.

check SO for similar questions and for more exhaustive answers. Basically things get a lot easier if you don't want or don't need to support Micrsoft Live / Hotmail / Outlook email platform but even then it's still a faffy fiddle.

Please see this post by the guy who now looks after the PHPMailer project: Do we still need to use <font> tags in HTML emails?

like image 82
Martin Avatar answered Mar 19 '23 05:03

Martin