Posted by Tyno Gendo on 04/07/07 12:16
Gordon Burditt wrote:
>> I am trying to build an email address in PHP code using v5.1.2. All
>> works well until I try to surround the email address with angle
>> brackets.
>
> Have you considered viewing the result in something other than HTML?
> (or using the "view source" function of your browser?) I believe
> the string really is there; you <dead cat> just don't see it
> <dead cat> in a browser <dead cat>. When you read this, how many
> dead cats are there in the previous sentence? There are three.
>
>> Every method I try causes the email address to disappear
>> completely. I have to believe that this is a common problem, but I
>> can't find any answers in the PHP docs or in Google. Any insight
>> would be greatly appreciated. Below are some of my failed attempts.
>>
>> $strAddressee = "$ContactName "."<"."$ContactEmail".">";
>> (brackets and email address disappear)
>>
>> $strAddressee = "$ContactName <$ContactEmail>";
>> (brackets and email address disappear)
>>
>> $strAddressee = "$ContactName \074 $ContactEmail \076";
>> (works, except for unwanted spaces between the brackets and address)
>>
>> $strAddressee = "$ContactName \074{$ContactEmail}\076";
>> (brackets and email address disappear)
>
> If you want to output this string on a web page and *only* on a
> web page, try:
>
> $strAddressee = "$ContactName <$ContactEmail>";
>
> but if you put that in mail headers it will probably screw up.
>
>
if you wanted to write out the strAddressee as debug on an html page and
it had the angle brackets in, you would have to do:
echo htmlentities($strAddressee);
That would encode the debug so you could see the angle brackets.
[Back to original message]
|