Jump to content

Change the color of text


mariocesar

Recommended Posts

Hello, how can I change the color of text on a mail content, if I want to make the color of Company, Name, Address, City (green) here is the code

$mailContent="--------Contact--------\n\n" 
            ."Company: ".$company."\n"
            ."Name: ".$firstname."".$lastname."\n" 
            ."Address: ".$address."\n"
."City: ".$city."\n"
."State: ".$state."\n";

Thanks.

Link to comment
Share on other sites

first off, the email have to be send in html format.

 

something like this will change the color:

<font color="green">City</font>

 

secondly, you posted in a wrong forum

 

 

Wrong emails are not html at all.  Its an option, and a poor one because only about 25% of email clients have full html support, the rest don't accept html.  Emails are text first with the option to be html.

Link to comment
Share on other sites

 

only about 25% of email clients have full html support, the rest don't accept html.  Emails are text first with the option to be html.

 

25%? You must be talking about the '90 where people still using DOS and Win95.

 

By experience, I'd say 99% of people have html-support email clients.

 

Link to comment
Share on other sites

_multi part emails_

 

The acceptance ratio between html  text isn't really that important, what is important is making sure you send BOTH versions, and send them both correctly.

 

Recipients always have the option to receive text emails vs html. usually to try and avoid harmful content. Between us dev headz, there is very, very little support by any of the major players to correctly support html, to boot those on Vista / Outlook will be even worse off with the new outlook using word to render your messages. But that is no reason to not send html out, those who accept it, generally do so for a reason.

 

With that aside, let me touch on question...

yes you can send your email with a green font, should you use a font tag? i would say no, you should use inline styles when dealing with html email layouts. font tags are so 1999 ;)

 

another tip, do not use css to layout html in an email, it will never work on the majority of client apps.

 

so what you should do is power up your favorite php editor and create either some functions or a class, that will help you send out emails.

one approach would be to create your html email however you want it ( feel free to leave a flag for any place holder variables you need to pass through, i always go #EmailAddress#). then take that exact text in your email, and dump it into a new text file. then in your process page send the path locations to some sort of function/class that will deal with sending these out. This will make it easy to use again and again and again and again.

 

these should get you started:

http://us2.php.net/mail

http://www.zend.com/zend/spotlight/sendmimeemailpart1.php

 

best of luck to you

Link to comment
Share on other sites

sending both is worse than sending html only.  Reason its considered spam.  You ask clients what they prefer in their email, if you send html your odds of having a consitent phrasing, and acceptance rate over 75% are gone, an email is a message and doesn't need fancy formatting and so forth, you will save you self a lot of headaches doing text only emails unless you see an absolute need for html (As in this case with a need for coloring).  Sending email with php is hard enough already, why add that burden to it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.