Re: detecting HTML tags

From: Date: Tue, 15 May 2001 18:55:21 +0000
Subject: Re: detecting HTML tags
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52909@lists.php.net to get a copy of this message
bill <bill@billtron.com> wrote: > > Is there a way to detect the presence of HTML tags? > > I don't want them stripped out, I just want to know if a string contains > them. > > I'm rolling my own mailing program and want it to detect the HTML if > present and send it appropriately. > > kind regards, > > bill hollett > Regex is the way to go, but as an aside - the mere presence of html tags in a mail message body does not make it an HTML message. It is perfectly reasonable to send a message containing something like this: "That HTML tag you're looking for is <span>" and expect it to NOT be rendered as HTML on the other end but displayed exactly as you typed it. Likewise it's legitimate to send a "text/html" message that contains no HTML elements at all. When sending HTML mail a program should only set the content-type to "text/html" if the sender explicitly requests it, not when it detects HTML elements in the body. Mark

« previous php.general (#52909) next »