Gossamer Forum
Home : Products : DBMan : Customization :

e-mail formatting

Quote Reply
e-mail formatting
I've been able to get dbman to insert line breaks in a textarea field through the help of the forums, however, when it e-mails the contents of the record it inserts the < br> tags. Here is the mail portion of html.pl

my (%rec) = &get_record($in{$db_key});


$message=qq|
Show Date: $rec{'Show Date'}

Source: $rec{'Source'}

Review:
$rec{'Review'}

$rec{'Reviewed By'}'s vote: $rec{'Your Vote'}|;

open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $group_email\n";
print MAIL "From: $group_email2\n";
print MAIL "Subject: $rec{'Show Date'} Review\n\n";
print MAIL "The following new review has been added by $rec{'Reviewed By'} to the $html_title:
$message.\n\n";
foreach $col ($db_cols) {
print MAIL "$col -- $rec{$col}\n";

}
close (MAIL);

$page_title = "Record Added";
&html_page_top;

# < -- Start page text -- >
print qq|
<P><$font><$font_color2>The following record was successfully added to the database:</FONT>
|;
# < -- End page text -->

&html_record_long(&get_record($in{$db_key}));

&html_footer;
&html_page_bottom;
}


I've tried many suggestions on the forum but I can't get it to work.

Thanx

Mike
Quote Reply
Re: [cheezehead] e-mail formatting In reply to
Are you actually putting < BR > tags within a textarea, or have you put at the top of your html_record or html_record_long the following:

$rec{'Review'} =~ s/\n/<BR>/g;

so that the script will automatically add the line breaks when the enter key is pressed.

If so then the actual line break tag should not appear in your output.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [cheezehead] e-mail formatting In reply to
I did insert $rec{'Review'} =~ s/\n/<BR>/g; sub_record and and sub_record_long but it had no effect on e-mails. It did fix all new entries into the database, however the old entries were still without line breaks.

I followed JPDeni's instructions at this thread http://www.gossamer-threads.com/...m.cgi?post=2007#2007 . That helped format the output display on previous entries and made any new ones look good. However the e-mails still display the < BR> tags along with the modify display.

I've attached my html.pl. I've spent a week going through all the posts and tried the various fixes that I could find but to know avail. If you could take a quick look I'd appreciate it greatly.

Thanx for your time,

Mike
Quote Reply
Re: [cheezehead] e-mail formatting In reply to
Sorry about that here is the html.pl
Quote Reply
Re: [cheezehead] e-mail formatting In reply to
>>
I've attached my html.pl
<<

Wow you made it invisible too Laugh
Quote Reply
Re: [cheezehead] e-mail formatting In reply to
I spotted a few problems while looking at your html.pl file. This may not be causing your email problem but it sure doesn't help.


In sub html_page_top

I noticed you have:

<td><img src="http://www.joyfulsounds.org/images/joylogo3.gif" border="0" width="75" height="100" alt="joyful logo"</td>

Notice the ending of your <img src code is missing the closing >

------------------------

I don't see the $rec{'Review'} =~ s/\n/<BR>/g; below my (%rec) = @_;

in your sub html_record or sub html_record_long ??

If you add that code then provided the enter key was used within the record to create line breaks it should automatically display old records just fine. If people have manually entered < BR > tags you should remove them directly within the .db file.

You can make a note within your form for those entering records to add the line breaks by hitting their enter key.

foreach $col ($db_cols) {
print MAIL "$col -- $rec{$col}\n";

Is to display all your database fields within the email. So you may want to either just list the fields the print statments
print MAIL "Show Date: $rec{'Show Date'}\n";
etc.

or choose to show them all.

-----------------

In your short display you have:

print "<table width=100%><TD>";

print qq| <a href="$long_url">$rec{'Show Date'}</a> |;

# if you want to display your fields in columns, use the following format:
print qq|
<td width=30%><$font2><$font_color3><B>Reviewed By </font><$font_color2><B>$rec{'Reviewed By'}</B></font></td>
<td width=6%></td>
<td width=30% align=center><$font2><$font_color3><B>$rec{'Your Vote'}</B></td>|;

print "</TD></TABLE>"; # do not remove


The actual table code starts in sub html_view_success so you should only need to keep it at the default of starting with <TD> and ending with </TD> within the short display.
You might want to change that to:

print "<TD>";

print qq| <a href="$long_url">$rec{'Show Date'}</a></TD> |;
<td width=30%><$font_color3><B>Reviewed By </font><$font_color2><B>$rec{'Reviewed By'}</B></font></td>
<td width=6%>&nbsp;</td>
<td width=30% align=center><$font_color3><B>$rec{'Your Vote'}</B></FONT></td>|;

print "</TD>"; # do not remove

=============

In your html record_long you have my (%rec) = @_; at the top where it belongs and then it's repeated again prior to the start of your table?

#display#
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

-----------------
I've as noticed you have several places where you are opening a font tag prior to closing a previous font tag such as:

<$font><$font_color3>


Carefully check over all the html coding you have added, or better yet view the source of your pages and then validate the coding to be sure you catch and correct any and all html errors which may be causing you problems.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/