Creating a string that contains < character

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dickey
Forum Commoner
Posts: 50
Joined: Thu May 16, 2002 8:04 pm
Location: Sydney, Australia

Creating a string that contains < character

Post by dickey »

I wish to create a string containing the < char for use with mail().

eg "First Name Last Name <username@domainname>"

I'm using an array ($list) containing data from a mysql table (fname, lname, email)

Why doesn't this work?

$to = '"';
$to .= $list['fname'];
$to .= ' ';
$to .= $list['lname'];
$to .= ' <';
$to .= $list['email'];
$to .= '>"';

It bombs when it hits the < char.

Any assistance appreciated.

- Andrew
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it depends on where you are passing the $to variable.. if you are passing it outside the headers of the mail, then yes, it should fail. Only the email address being sent to is supposed to be in the "to" argument of mail.. last I checked anyways..
Post Reply