Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 04-03-2005, 02:57 PM Changing Font
Junior Talker

Posts: 2
Trades: 0
Can anyone help. I've got a PHP script on a contact us page, and have an automated email saying thanks for your email, blah blah, what I want to do is to change the font, but I've tried and keep getting a message saying there's an error in the code, what I've got is this

$messagetosender="$Thank you for your enquiry \n\rWe will endeavour to respond to your request within 48 hours \n\r\n\rXXX";

Can anyone help with changing the font to COmic Sans?
njarrold is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-03-2005, 03:37 PM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Hmmm. Do you send it as text/html ? If so, add to your body attribute style="font-family: "Comic Sans;" and it should work. I have to admit that I haven't tried it but I'm almost sure that it'will work...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 04-04-2005, 05:07 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Before sorting out your font size problem, let's sort out the code problem you have right there

Quote:
$messagetosender="$Thank you for your enquiry \n\rWe will endeavour to respond to your request within 48 hours \n\r\n\rXXX";
Why is there a $Thank at the beginning, $ should only be used to tell PHP that the single word attached is a variable - I doubt $Thank is a variable unless your English is poor.

Secondly, it's good practise when doing things like emails in php to split the lines, to tidy it up. Also, PHP is going to moan about the fact you have \n in there, so to get around this, all we have to simply do is escape them, notice the use of claiming the variable using '' not "":

PHP Code:
$messagetosender 'Thank you for your enquiry ' "\n\r" 'We will 
endeavour to respond to your request within 
48 hours ' 
"\n\r\n\r" 'XXX'
I have no idea what the XXX bit at the end is for, but i assume you know
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 11:47 AM
Junior Talker

Posts: 2
Trades: 0
Thanks but that didn't seem to work, just told me I had an error on line 2

I also tried to tidy up the code as per your suggestion and it kept telling me I had an error on line 34, so thanks but I left it as it was.

Still can't change the font, can anyone help?
njarrold is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 12:24 PM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Either you haven't read my reply or you haven't unserstood it or you simple have no idea about CSS/PHP/HTML...

But there you go - that's the code:

PHP Code:
<?php

    $sender
='sender@somewhere.something';
    
$name='Sender name';
    
$recipient="somebody@somewhere.something";

    
$x_mailer="PHP ".phpversion();
    
$headers="MIME-Version: 1.0\r\n";
    
$headers.="Content-Type: text/html; charset=UTF-8\r\n"
    
$headers.="Return-Path: ".$sender."\r\n";    
    
$headers.= "From: =?UTF-8?B?".base64_encode($name)."?= <".$sender."> \r\n";
    
$headers.="Reply-To: ".$sender."\r\n";
    
$headers.="X-Mailer: ".$x_mailer."\r\n";
    
    
$content="<html><head></head><body style=\"font-family: 'Comic Sans MS'; font-size: 20px;\">";
    
$content.="SAMPLE TEXT...";
    
$content.="</body></html";
    
    
$topic="=?UTF-8?B?".base64_encode("SAMPLE MAIL TOPIC")."?="
    
    
mail($recipient,$topic,$content,$headers);
    
?>
Note, that in this sample code, the encoding is UTF, name of the font is "COMIC SANS MS" - I use Windows and there's no 'Comic Sans' font at all in the system. I've just written it and tested in Thunderbird - in the mail I've got, the text is written in 20px Comic Sans MS so it works.

Everything clear?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Reply     « Reply to Changing Font
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.58451 seconds with 12 queries