I have a script I'm currently working on where the user inputs the information into a form, previews the page and then a email is sent to the appropite party.

Currently, this is all functional except after the preview screen, the email produces the information in the box, but adds the <BR> code next to the information submitted.

I cannot figure out a way to remove the line break code without loosing the data. Code is as follows:

Preview Email:

unless ($cur_contact eq "")
	{
$cur_contact1 = $cur_contact;
$cur_contact =~ s/\r/<BR>/g;
print <<EOHTML;
--------------------------------------------------------------------<BR>
            <B>CURRENT CONTACT INFORMATION:</B><BR><BR>
			<FONT CLASS="text4">$cur_contact1</FONT><BR>
--------------------------------------------------------------------<BR><BR>
EOHTML
	}
unless ($cur_servers eq "")
	{
$cur_servers1 = $cur_servers;
$cur_servers =~ s/\r/<BR>/g;
print <<EOHTML;
--------------------------------------------------------------------<BR>
            <B>CURRENT SERVER NAMES:</B><BR><BR>
			<FONT CLASS="text4">$cur_servers1</FONT><BR>
--------------------------------------------------------------------<BR><BR>
EOHTML
	}

Send Email:

unless ($cur_contact eq "")
	{
print $msg <<EOMAIL;
--------------------------------------------------------------------
CURRENT CONTACT INFORMATION:
$cur_contact
--------------------------------------------------------------------
EOMAIL
	}
unless ($cur_servers eq "")
	{
print $msg <<EOMAIL;
--------------------------------------------------------------------
CURRENT SERVER NAMES:
$cur_servers
--------------------------------------------------------------------
EOMAIL
    }

emails can be viewed as plain text or as html encoded, and even if html encoded the end user can elect to see emails as plain text. You should decide which route to take, text or html encoded, and then work on a solution.

A side-note to this is that it really has nothing to do with perl or CGI, but how you elect to send the emails, as text or html.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.