Gossamer Forum
Home : Products : DBMan : Customization :

HTML in Text Area for Forward Record Mod

Quote Reply
HTML in Text Area for Forward Record Mod
I have the Private Mailer Mod (and the Forward Record Mod) working well. One question:

How can you include html in the text area and send the message in html format instead of plain text format?

Here is a sample of what I have fo a test:

Code:
<textarea name="emailmessage" cols=40 rows=10 wrap="virtual"><b>$rec{'JobName'}</b></textarea>

When my send record form pops up, my html code is as defined above:

Example:

<b>49th Street Job</b>

However, when I send it and retrieve the email, the html markup is printed instead of being translated and my email shows <b>49th Street Job</b> instead of 49th Street Job.

Anyone know how to convert it to html instead of plain text or can't it be done?

[This message has been edited by BrianYork (edited January 07, 2000).]
Quote Reply
Re: HTML in Text Area for Forward Record Mod In reply to
Hi, I don't know if this will help, but it seems to me that you need to include a few other tags to make an html page.

Code:
<HTML><HEAD></HEAD><BODY><textarea name="emailmessage" cols=40 rows=10 wrap="virtual"><b>$rec{'JobName'}</b></textarea>[/b]</BODY></HTML>

Fred
Quote Reply
Re: HTML in Text Area for Forward Record Mod In reply to
The best thing to do is add the following attribute to the textarea codes:

Code:
wrap=physical/virtual

BTW: Virtual wrapping is only what shows up on the screen. Adding Physical wrapping will affect the display of text in the actual message.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: HTML in Text Area for Forward Record Mod In reply to
Thanks Fred and Eliot for your replies. However, both of you have misunderstood what I was trying to explain.

I want to send html formatted email and not plain text email. This would mean the textarea would have html code within it that would be sent to someone's email client. When they open the email to read it, it would look like a web page instead of plain text. I already know how to get my html code into the test area.

Fred's code will not work because the html codes he provided are NOT within the textarea. Eliot's tip is useful, but does not apply to what I was looking for.

However, I feel good again today for the second time! I have figured out a way to modify the code so that when using the forward record mod or the private emailer mod, the ability exists to send html email instead of plain text email.

Here is what you need to do in case anyone is interested. This does require the addition of another file called mimelite.pm that can be found on the web.

1) Get the mimelite.pm module and upload it (ascii mode) into the same directory as DBMan. Chmod it to 777 (that's what I used because I wasn't sure). If you can't find the right mimelite.pm module, I will post it as a text file for anyone interested).

2) In default.cfg, add the following code to your configuration options:

Code:
# Full directory path to where mimelite.pm html mailer is located.
use lib "/path/to/your/dbman/directory";
use mimelite;

3) In db.pl, find and change the following code in the new sub forward_email:

Code:
open (MAIL, "$mailprog") &#0124; &#0124; &cgierr("unable to open mail program");
print MAIL "To: $in{'to_email'})\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: $in{'subject'}\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL $in{'emailmessage'};
close (MAIL);

Change it to:

Code:
open (MAIL, "$mailprog") &#0124; &#0124; &cgierr("unable to open mail program");
print MAIL "To: $in{'to_email'})\n";
print MAIL "From: $in{'email'}\n";
print MAIL "X-Mailer: MIME::Lite\n";
print MAIL "Content-type: text/html\n\n";
print MAIL $in{'emailmessage'};
close (MAIL);

4) Now,you have 2 options:

a) "hard code" your record to be forwarded and any html formatting within the new sub html_forward_email_form in html.pl

Example (look for this line):

Code:
<textarea name="emailmessage" cols=40 rows=10 wrap="virtual"><h3>$rec{'Name'}</h3><br><font face="arial" size="3">$rec{'Email'}</font></textarea></td></tr>

etc, etc, etc.

or option 2:

b) Leave the text area blank and when the send email form pops up, let the user enter their own message with any html markup they wish to include.

When the message is sent, any email clients that can read html messages will see a message that looks like a web page!

Again, if anyone needs the mimelite.pm file, I will post it or email it to you. Smile
Quote Reply
Re: [BrianYork] HTML in Text Area for Forward Record Mod In reply to
Brian - Where can I get this mimelite.pm module?

TIA,

Donm