Gossamer Forum
Home : Products : Links 2.0 : Customization :

Text to html on Birdcast2.cgi

Quote Reply
Text to html on Birdcast2.cgi
How would I change the email that is sent out be changed from text to html, or at least the description. If you go to my site at http://searchat.virtualave.net and send something to yourself, you will understand why I need it to be html.


SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
1) Change the MIME type.
2) Add HTML codes in the send email sub.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Eliot, the mails send through the newsletter feature from the admin panel only sends in txt fromat. How can i make it to send in HTML format.

Best Regs
JackofNone

Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Here is the code of the email that is getting sent out if you want me to post the whole code, just let me know. Otherwise MIME is not listed on this code.

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;

Hi $fields{$recipname},

$fields{'send_name'} stopped by $SITE_NAME
and suggested that you visit the following URL:

Site Name: $rec{'Title'}
Site Location: $rec{'URL'}
Site Description:$rec{'Description'}


__STOP_OF_MAIL__


if ($fields{'message'} ne "")
{
$msgtxt .= "Here is a personal message from $fields{'send_name'}....\n";
$msgtxt .= "--------------------------------------\n\n";
$msgtxt .= "$fields{'message'}\n\n";
$msgtxt .= "--------------------------------------\n\n";

}
$msgtxt .= "$SITE_NAME\n";
$msgtxt .= "$ENDLINE\n";
$msgtxt .= "$SITE_URL\n\n";
$mailresult = &sendmail(
$fields{send_email},
$fields{send_email},
$fields{$recipemail},
$SMTP_SERVER,
$subject,
$msgtxt,
$carbon
);


if ($mailresult ne "1")
{print "Content-type: text/html\n\n";
print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
exit
}

}
}
Thanks, Kevin



SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Can't anyone help me on the above problem, Pleeeeeeaaaaasssseeee!!!!!!!!!!!!!!!

SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Search the Perl/CGI forum for HTML MIME email.

Regards,

Eliot Lee
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
I just did what you suggested and it came up with no matches. I have also written the author of this script with no response as of yet. If you can please help with the code, it would be greatly appreciated. Here is the whole cgi process code for birdcast2.cgi.

#!/usr/local/bin/perl
use Socket;
require "/home/webbus/public_html/cgi-bin/links/admin/links.cfg";
require "$db_script_path/links.def";
require "$db_script_path/db_utils.pl";
$|=1;

##################################################################
# birdcast.cgi Version 2.0
# updated May 2, 1999
# (C)1998, 1999 Bignosebird.com
# This software is FREEWARE! Do with it as you wish. It is yours
# to share and enjoy. Modify it, improve it, and have fun with it!
# It is distributed strictly as a learning aid and bignosebird.com
# disclaims all warranties- including but not limited to:
# fitness for a particular purpose, merchantability, loss of
# business, harm to your system, etc... ALWAYS BACK UP YOUR
# SYSTEM BEFORE INSTALLING ANY SCRIPT OR PROGRAM FROM ANY
# SOURCE!
##################################################################

# CONFIGURATION NOTES

#
# $SCRIPT_NAME is the full URL of this script, including the
# http part, ie, "http://domainname.com/cgi-bin/birdcast.cgi";
#
# $SITE_NAME is the "name" of your web site.
# $SITE_URL is the URL of your site (highest level)
# $END_LINE is the very last line printed in the e-mail.
#
# $MAXNUM is the number of possible people a person can refer
# your URL to at one time. If you call the script using the
# GET method, then this is also the number of entry blanks
# created for recipient names and addresses.
#
# $SMTP_SERVER is the name of your e-mail gateway server, or
# SMTP host. On most systems, "localhost" will work just fine.
# If not, change "localhost" to whatever your ISP's SMTP
# server name is, ie, smtp.isp.net or mail.isp.net

# $SEND_MAIL is the full path to your server's sendmail program
# If you do not wish to use Sockets for some reason and need
# to use sendmail, uncomment the $SEND_MAIL line and comment
# the $SMTP_SERVER line.

# okaydomains is a list of domains from which you want to allow
# the script to be called from. Leave it commented to leave the
# script unrestricted. If you choose to use it, be sure to list
# your site URL with and without the www.

# Use either $SMTP_SERVER
# $SMTP_SERVER="localhost";
#
# OR
#
$SEND_MAIL="/usr/sbin/sendmail -t";
#
# BUT NEVER BOTH!!!!!!

# @okaydomains=("http://yourdomain.com", "http://www.yourdomain.com");

$SCRIPT_NAME="http://searchat.virtualave.net/cgi-bin/links/birdcast2.cgi";
$SITE_NAME="SearchAt!";
$SITE_URL="http://searchat.virtualave.net/";
$ENDLINE="";
$MAXNUM=5;
$LOGFILE="reflog.txt";

if ($SENDMAIL ne "")
{&test_sendmail;}


&valid_page; #if script is called from offsite, bounce it!
&decode_vars;
%rec = &get_record($fields{'ID'});
if ($ENV{'REQUEST_METHOD'} ne "POST")
{
&draw_request;
exit;
}
&do_log;
&process_mail;
print "Location: $JUMP_TO\n\n";

##################################################################
sub process_mail
{
my $carbon = "Bcc: searchat\@2xtreme.net";
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}

#BNB SAYS! You can modify the Subject line below.

$subject = "Web Link Suggestion from $fields{'send_name'}";

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;

Hi $fields{$recipname},

$fields{'send_name'} stopped by $SITE_NAME
and suggested that you visit the following URL:

Site Name: $rec{'Title'}
Site Location: $rec{'URL'}
Site Description:$rec{'Description'}


__STOP_OF_MAIL__


if ($fields{'message'} ne "")
{
$msgtxt .= "Here is a personal message from $fields{'send_name'}....\n";
$msgtxt .= "--------------------------------------\n\n";
$msgtxt .= "$fields{'message'}\n\n";
$msgtxt .= "--------------------------------------\n\n";

}
$msgtxt .= "$SITE_NAME\n";
$msgtxt .= "$ENDLINE\n";
$msgtxt .= "$SITE_URL\n\n";
$mailresult = &sendmail(
$fields{send_email},
$fields{send_email},
$fields{$recipemail},
$SMTP_SERVER,
$subject,
$msgtxt,
$carbon
);


if ($mailresult ne "1")
{print "Content-type: text/html\n\n";
print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
exit
}

}
}

##################################################################
sub draw_request
{
print "Content-type: text/html\n\n";

#BNB SAYS! Here is the part that draws the page that asks the
#reader to enter e-mail addresses and names. Tailor it to meet
# your needs if necessary. DO NOT disturb the lines with
# __REQUEST__ on them.

print <<__REQUEST__;
<BODY BGCOLOR="../../bck-110.jpg">
<CENTER>

<P>
<TABLE WIDTH=550 BGCOLOR="CCE6FF">
<TR>
<TD>
<FONT FACE="ARIAL" SIZE=4 COLOR="#009999">
<B>
<CENTER>
SUGGEST THIS LINK TO A FRIEND...<P>
$rec{'Title'} <BR>
$rec{'URL'} <BR>
$rec{'Description'}

</CENTER>
</B>
</FONT>
<BLOCKQUOTE>
<FONT FACE="ARIAL" SIZE=2 COLOR="#000000">
If you have a friend that you would like to recommend this page to,
or if you just want to send yourself a reminder, here is the easy
way to do it!
<P>
Simply fill in the e-mail address of the person(s) you wish to tell
about $SITE_NAME, your name and e-mail address (so they do
not think it is spam or reply to us with gracious thanks),
and click the <B>SEND</B> button.
If you want to, you can also enter a message that will be included
on the e-mail.
<P>
After sending the e-mail, you will be transported back to the
page you recommended!
</FONT>
<FORM METHOD="POST" ACTION="$SCRIPT_NAME">
<INPUT TYPE="HIDDEN" NAME="call_by" VALUE=$ENV{'HTTP_REFERER'}>
<input type="hidden" name="ID" value="$rec{'ID'}">
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 >
<TR>
<TD> </TD>
<TD ALIGN=CENTER><B>Name</B></TD>
<TD ALIGN=CENTER><B>E-Mail Address</B><TD>
</TR>
<TR>
<TD><B>You</B></TD>
<TD><INPUT TYPE="TEXT" NAME="send_name"></TD>
<TD><INPUT TYPE="TEXT" NAME="send_email"></TD>
</TR>
__REQUEST__
for ($i=1;$i<$MAXNUM+1;$i++)
{
print <<__STOP_OF_ROW__;
<TR>
<TD><B>Friend $i</B></TD>
<TD><INPUT TYPE="TEXT" NAME="recipname_$i"></TD>
<TD><INPUT TYPE="TEXT" NAME="recipemail_$i"></TD>
</TR>
__STOP_OF_ROW__
}
print <<__REQUEST2__;
<TR>
<TD> </TD>
<TD ALIGN=CENTER COLSPAN=2>
<B>Your Message</B><BR>
<textarea name="message" wrap=virtual rows=5 cols=35></textarea>
<BR>
<INPUT TYPE="submit" VALUE="SEND">
</TD>
</TR>
</TABLE>
</FORM>
</BLOCKQUOTE>
<CENTER>
<FONT SIZE="-1">
Free recommendation script created by<BR>
</FONT>
<A HREF="http://bignosebird.com/"><B>BigNoseBird.Com</B></A><BR>
<FONT SIZE="-1">
<I>The Strangest Name in Free Web Authoring Resources<I><BR>
</FONT>
<P>
</CENTER>
</TD>
</TR>
</TABLE>
__REQUEST2__
}

##################################################################
# NOTHING TO MESS WITH BEYOND THIS POINT!!!!
##################################################################
sub decode_vars
{
$i=0;
if ( $ENV{'REQUEST_METHOD'} eq "GET")
{
$temp=$ENV{'QUERY_STRING'};
}
else
{
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
}
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$content=~s/\012//gs;
$content=~s/\015/ /gs;
$fields{$key}=$content;
}
if ($fields{'call_by'} eq "")
{
$JUMP_TO = $ENV{'HTTP_REFERER'};
}
else
{
$JUMP_TO = $fields{'call_by'};
}
}

##################################################################
sub valid_address
{
$testmail = $fields{$recipemail};
if ($testmail =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
$testmail !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)
{
return 0;
}
else
{
return 1;
}
}

sub valid_page
{
if (@okaydomains == 0) {return;}
$DOMAIN_OK=0;
$RF=$ENV{'HTTP_REFERER'};
$RF=~tr/A-Z/a-z/;
foreach $ts (@okaydomains)
{
if ($RF =~ /$ts/)
{ $DOMAIN_OK=1; }
}
if ( $DOMAIN_OK == 0)
{ print "Content-type: text/html\n\n Sorry, cant run it from here....";
exit;
}
}


##################################################################
sub test_sendmail
{
@ts=split(/ /,$MAIL_PROGRAM);
if ( -e $ts[0] )
{
return;
}
print "Content-type: text/html\n\n";
print "<H2>$ts[0] NOTFOUND. PLEASE CHECK YOUR SCRIPT'S MAIL_PROGRAM VARIABLE</H2>";
exit;
}

sub do_log
{
(-e $LOGFILE) ?
open (ZL,">>$LOGFILE") :
open (ZL,">$LOGFILE");
$date=localtime(time);
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}
$logline="$date\|$JUMP_TO\|$fields{'send_email'}\|$fields{$recipemail}\|\n";
print ZL $logline;
}
close(ZL);
}

###################################################################
#Sendmail.pm routine below by Milivoj Ivkovic
###################################################################
sub sendmail {

# error codes below for those who bother to check result codes <gr>

# 1 success
# -1 $smtphost unknown
# -2 socket() failed
# -3 connect() failed
# -4 service not available
# -5 unspecified communication error
# -6 local user $to unknown on host $smtp
# -7 transmission of message failed
# -8 argument $to empty
#
# Sample call:
#
# &sendmail($from, $reply, $to, $smtp, $subject, $message );
#
# Note that there are several commands for cleaning up possible bad inputs - if you
# are hard coding things from a library file, so of those are unnecesssary
#

my ($fromaddr, $replyaddr, $to, $smtp, $subject, $message, $carbon) = @_;

$to =~ s/[ \t]+/, /g; # pack spaces and add comma
$fromaddr =~ s/.*<([^\s]*?)>/$1/; # get from email address
$replyaddr =~ s/.*<([^\s]*?)>/$1/; # get reply email address
$replyaddr =~ s/^([^\s]+).*/$1/; # use first address
$message =~ s/^\./\.\./gm; # handle . as first character
$message =~ s/\r\n/\n/g; # handle line ending
$message =~ s/\n/\r\n/g;
$smtp =~ s/^\s+//g; # remove spaces around $smtp
$smtp =~ s/\s+$//g;

if (!$to)
{
return(-8);
}

if ($SMTP_SERVER ne "")
{
my($proto) = (getprotobyname('tcp'))[2];
my($port) = (getservbyname('smtp', 'tcp'))[2];

my($smtpaddr) = ($smtp =~
/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
? pack('C4',$1,$2,$3,$4)
: (gethostbyname($smtp))[4];

if (!defined($smtpaddr))
{
return(-1);
}

if (!socket(MAIL, AF_INET, SOCK_STREAM, $proto))
{
return(-2);
}

if (!connect(MAIL, pack('Sna4x8', AF_INET, $port, $smtpaddr)))
{
return(-3);
}

my($oldfh) = select(MAIL);
$| = 1;
select($oldfh);

$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-4);
}

print MAIL "helo $SMTP_SERVER\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

print MAIL "mail from: <$fromaddr>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

foreach (split(/, /, $to))
{
print MAIL "rcpt to: <$_>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-6);
}
}

print MAIL "data\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close MAIL;
return(-5);
}

}

if ($SEND_MAIL ne "")
{
open (MAIL,"| $SEND_MAIL");
}

print MAIL "To: $to\n";
print MAIL "From: $fromaddr\n";
print MAIL "$carbon\n";
print MAIL "Reply-to: $replyaddr\n" if $replyaddr;
print MAIL "X-Mailer: Perl Powered Socket Mailer\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message";
print MAIL "\n.\n";

if ($SMTP_SERVER ne "")
{
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-7);
}

print MAIL "quit\r\n";
$_ = <MAIL>;
}

close(MAIL);
return(1);
}


Thank you in advance.


SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Guess you did NOT search hard enough....

READ the following Threads:

http://www.gossamer-threads.com/...200&Old=allposts

AND

http://www.gossamer-threads.com/...=&vc=1#Post65569

AND

http://www.gossamer-threads.com/...200&Old=allposts

AND

http://www.gossamer-threads.com/...200&Old=allposts

AND

http://www.gossamer-threads.com/...200&Old=allposts

AND

http://www.gossamer-threads.com/...200&Old=allposts

Still want more info....

SEARCH http://www.perl.com

AND in the future...USE THE FOLLOWING SEARCH OPTIONS IN THE FORUM
SEARCH FORM:

Forums SELECT SPECIFIC FORUM (like Perl/CGI)
Search Option AND
Date Range All posts
Hits 500

Got it?

Regards,

Eliot Lee
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Eliot,

I appreciate your help but you don't have to get mean about it. I am not an expert on cgi, but I am learning as I go. I have researched every post you put up but nothing will work. It only prints in text. You don't have to help me if you don't want to. Anyways once again here is the code that sends the email message.
##################################################################
sub process_mail
{
my $carbon = "Bcc: searchat\@2xtreme.net";
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}

#BNB SAYS! You can modify the Subject line below.

$subject = "Web Link Suggestion from $fields{'send_name'}";

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;


Hi $fields{$recipname},

$fields{'send_name'} stopped by $SITE_NAME
and suggested that you visit the following URL:

Site Name: $rec{'Title'}
Site Location: $rec{'URL'}
Site Description:$rec{'Description'}


__STOP_OF_MAIL__


if ($fields{'message'} ne "")
{
$msgtxt .= "Here is a personal message from $fields{'send_name'}....\n";
$msgtxt .= "--------------------------------------\n\n";
$msgtxt .= "$fields{'message'}\n\n";
$msgtxt .= "--------------------------------------\n\n";

}
$msgtxt .= "$SITE_NAME\n";
$msgtxt .= "$ENDLINE\n";
$msgtxt .= "$SITE_URL\n\n";
$mailresult = &sendmail(
$fields{send_email},
$fields{send_email},
$fields{$recipemail},
$SMTP_SERVER,
$subject,
$msgtxt,
$carbon
);


if ($mailresult ne "1")
{print "Content-type: text/html\n\n";
print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
exit
}

}
}

If it wasn't for the description, I would not care if it was in text or html, but I need at least the description part of the link recommendation to be in html so the search box can be displayed properly. If someone know how to do this, please help me because I am running out of ideas.
If anyone has a copy of birdcast2.cgi or any other similiar program that would reccommend a link and send the message in html please post it here.

Thanks Kevin


SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Just a thread I found whilst browsing:
[link]http://www.perlguru.com/showthread.php3?threadid=1607[/link]
Hope it helps!

-----
Toaster: A gift that every member of the family appreciates. Automatically burns toast.
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
FYI: To create "active" links in the forums, you need to use url between the brackets, not link.

Refer the Forum FAQ page:

http://www.gossamer-threads.com/.../faq_english.pl?Cat=

Regards,

Eliot Lee
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
This will work with sendmail, I am not sure how you would do SMTP.

Look for:

$SEND_MAIL="/usr/sbin/sendmail -t";

Change to:

$SEND_MAIL="/usr/sbin/sendmail -t";
$book_header = "whatever.txt";
$book_footer = "whatever2.txt";


Then in the sub sendmail make sure you have something like this. I use the open(BH, "$book_header"); to import the files that I use for my banner campaigns. It will work without them. There are also some special $field tags in the code below that I added so disregard them:

print MAIL "To: $to\n";
print MAIL "From: $fromaddr\n";
print MAIL "$carbon\n";
print MAIL "Reply-to: $replyaddr\n" if $replyaddr;
print MAIL "X-Mailer: Perl Powered Socket Mailer\n";
print MAIL "Subject: $subject\n\n";
print MAIL "\n\n";
print MAIL "Content-type: text/html\n\n";
print MAIL "<html>\n";
print MAIL "\n";
print MAIL "<body bgcolor=\"#FFFFFF\" link=\"#04649C\" vlink=\"#007FFF\" alink=\"#800080\">\n";
print MAIL "\n";

open(BH, "$book_header");
@head = <BH>;
print MAIL ("@head");
close(BH);

print MAIL "<div align=\"center\"><center>\n";
print MAIL "<table border=\"0\" width=\"90%\" cellpadding=\"3\"><tr><td width=\"100%\">\n";
print MAIL "\n";
print MAIL "$message";print MAIL "\n\n";
print MAIL "<p>---------------------------------------------------------</p>\n";
print MAIL "<p>Your friend in Christ,
\n";
print MAIL "$fields{'owner'}
\n";
print MAIL "<a href=\"$fields{'gburl'}\">$fields{'gbtitle'}</a></p>\n";
print MAIL "$ENDLINE\n";
print MAIL "<center><hr size=\"1\" color=\"#04649C\" width=\"90%\"></center>\n";
print MAIL "<p>Get your FREE \@homewithGod email account
\n";
print MAIL "An address Christians around the world can relate to!
\n";
print MAIL "<a href=\"http://freemail.homewithgod.net/email/scripts/loginuser.pl\">\n";
print MAIL "http://freemail.homewithgod.net/email/scripts/loginuser.pl</a></p>\n";
print MAIL "<center><hr size=\"1\" color=\"#04649C\" width=\"90%\"></center>\n";
print MAIL "</td></tr></table></center></div>\n";

open(BFH, "$book_footer");
@feet = <BFH>;
print MAIL ("@feet");
close(BFH);

print MAIL "</body>\n";
print MAIL "</html>\n";
print MAIL "\n";

if ($SMTP_SERVER ne "")
{
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);


Next create your html file and name it whatever.txt and whatever2.txt if you want to import a file and upload it to the same directory that the birdcast file is in.

Jimmy Crow
http://www.homewithgod.com/
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
jackofnone,

I posted the code about 5 or 6 months ago to change the admin mail to html. There wer changes made in the mailer.pm and I think the admin_html.pl Do a search for my username and html mail.


Jimmy Crow
http://www.homewithgod.com/
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Thank you for giving me this suggestion but I can't get it to work properly. It still sending it in text. Here is the sub process part
:{
my $carbon = "Bcc: searchat\@2xtreme.net";
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}

#BNB SAYS! You can modify the Subject line below.

$subject = "Web Link Suggestion from $fields{'send_name'}";

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;
Hi $fields{$recipname},

$fields{'send_name'} stopped by $SITE_NAME
and suggested that you visit the following URL:

Site Name: $rec{'Title'}
Site Location: $rec{'URL'}
Site Description: $rec{'Description'}
__STOP_OF_MAIL__





if ($fields{'message'} ne "")
{
$msgtxt .= "Here is a personal message from $fields{'send_name'}....\n";
$msgtxt .= "--------------------------------------\n\n";
$msgtxt .= "$fields{'message'}\n\n";
$msgtxt .= "--------------------------------------\n\n";

}
$msgtxt .= "$SITE_NAME\n";
$msgtxt .= "$ENDLINE\n";
$msgtxt .= "$SITE_URL\n\n";
$mailresult = &sendmail(
$fields{send_email},
$fields{send_email},
$fields{$recipemail},
$SMTP_SERVER,
$subject,
$msgtxt,
$carbon
);


if ($mailresult ne "1")
{print "Content-type: text/html\n\n";
print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
exit
}

}
}


Here is the sub send mail part with the part that you suggested I added with a slight modification.

sub sendmail {

# error codes below for those who bother to check result codes <gr>

# 1 success
# -1 $smtphost unknown
# -2 socket() failed
# -3 connect() failed
# -4 service not available
# -5 unspecified communication error
# -6 local user $to unknown on host $smtp
# -7 transmission of message failed
# -8 argument $to empty
#
# Sample call:
#
# &sendmail($from, $reply, $to, $smtp, $subject, $message );
#
# Note that there are several commands for cleaning up possible bad inputs - if you
# are hard coding things from a library file, so of those are unnecesssary
#

my ($fromaddr, $replyaddr, $to, $smtp, $subject, $message, $carbon) = @_;

$to =~ s/[ \t]+/, /g; # pack spaces and add comma
$fromaddr =~ s/.*<([^\s]*?)>/$1/; # get from email address
$replyaddr =~ s/.*<([^\s]*?)>/$1/; # get reply email address
$replyaddr =~ s/^([^\s]+).*/$1/; # use first address
$message =~ s/^\./\.\./gm; # handle . as first character
$message =~ s/\r\n/\n/g; # handle line ending
$message =~ s/\n/\r\n/g;
$smtp =~ s/^\s+//g; # remove spaces around $smtp
$smtp =~ s/\s+$//g;

if (!$to)
{
return(-8);
}

if ($SMTP_SERVER ne "")
{
my($proto) = (getprotobyname('tcp'))[2];
my($port) = (getservbyname('smtp', 'tcp'))[2];

my($smtpaddr) = ($smtp =~
/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
? pack('C4',$1,$2,$3,$4)
: (gethostbyname($smtp))[4];

if (!defined($smtpaddr))
{
return(-1);
}

if (!socket(MAIL, AF_INET, SOCK_STREAM, $proto))
{
return(-2);
}

if (!connect(MAIL, pack('Sna4x8', AF_INET, $port, $smtpaddr)))
{
return(-3);
}

my($oldfh) = select(MAIL);
$| = 1;
select($oldfh);

$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-4);
}

print MAIL "helo $SMTP_SERVER\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

print MAIL "mail from: <$fromaddr>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

foreach (split(/, /, $to))
{
print MAIL "rcpt to: <$_>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-6);
}
}

print MAIL "data\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close MAIL;
return(-5);
}

}

if ($SEND_MAIL ne "")
{
open (MAIL,"| $SEND_MAIL");
}

print MAIL "To: $to\n";
print MAIL "From: $fromaddr\n";
print MAIL "$carbon\n";
print MAIL "Reply-to: $replyaddr\n" if $replyaddr;
print MAIL "X-Mailer: Perl Powered Socket Mailer\n";
print MAIL "Subject: $subject\n\n";
print MAIL "\n\n";
print MAIL "Content-type: text/html\n\n";
print MAIL "<html>\n";
print MAIL "\n";
print MAIL "<body bgcolor=\"#FFFFFF\" link=\"#04649C\" vlink=\"#007FFF\" alink=\"#800080\">\n";
print MAIL "\n";

print MAIL "$message";
print MAIL "</body>\n";
print MAIL "</html>\n";
print MAIL "\n";


if ($SMTP_SERVER ne "")
{
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-7);
}

print MAIL "quit\r\n";
$_ = <MAIL>;
}

close(MAIL);
return(1);
}

Why is it still printing text? I just don't understand it. Goto http://searchat.virtualave.net and try to send an email to yourself to see what I mean. Below is what I received.


.
Content-type: text/html

<html>

<body bgcolor="#FFFFFF" link="#04649C" vlink="#007FFF" alink="#800080">

Hi k2,

k stopped by SearchAt!
and suggested that you visit the following URL:

Site Name: NetNation
Site Location: http://click.linksynergy.com/fs-bin/stat?id=aedM2PuLWFY&offerid=6822.10000001&type=3&subid=0
Site Description: <FORM METHOD=POST ACTION="http://click.linksynergy.com/fs-bin/statform"><input type=hidden name=id value=aedM2PuLWFY><input type=hidden name=offerid value=6822><input type=hidden name=bnid value=2><input type=hidden name="subid" value="">
<table width="120" border="0" cellspacing="" cellpadding="4" bgcolor="#EEEEEE">

<tr >
<td colspan=2 BGCOLOR="#0080A0">
<font face="Arial" size="2" color="white"><b >Domain Name Search</b ></font >
</td >
</tr >

<tr valign="top" width=150>

<td ><font face="Arial" size="1" color="Black"><b >Search here</b ></font >
<input type="text" name="domain" size="15" maxlength="22">

</td >
<td width=50 valign=bottom>
<input type="Submit" name="" value="Go">

</td >
</tr >
<tr >
<td colspan=2>
<font face="Arial" size="1" color="navy">Enter a domain name or keywords</font >
</td >
</tr >
</TABLE >
</FORM >

<IMG width=1 height=1 border=0 src="http://ad.linksynergy.com/fs-bin/show?id=aedM2PuLWFY&bids=6822&type=5"><IMG border=0 width=1 height=1 src="http://ad.linksynergy.com/fs-bin/show?id=aedM2PuLWFY&bids=6822.10000001&type=3&subid=0" >
Here is a personal message from k....
--------------------------------------

here it is

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

SearchAt!

http://searchat.virtualave.net/

</body>
</html>

I am diffently not a perl expert. So please help me. Thanks in advance


SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
I am no perl expert either, but this may be happening because you are requiring Mailer.pm in the script. If you have the default Mailer.pm that sends in text format. I have altered my Mailer.pm to send html. Search under my username and html and you will find the code for changing it. I posted it about 5 or 6 months ago. I have also forwarded an example of the emails that are sent to my users to you.

Jimmy Crow
http://www.homewithgod.com/
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
Actually this is a self sufficient mailing program within it self. Below is the whole script for birdcast.cgi that I currently have on my site.

#!/usr/local/bin/perl
use Socket;
require "/home/webbus/public_html/cgi-bin/links/admin/links.cfg";
require "$db_script_path/links.def";
require "$db_script_path/db_utils.pl";
$|=1;

##################################################################
# birdcast.cgi Version 2.0
# updated May 2, 1999
# (C)1998, 1999 Bignosebird.com
# This software is FREEWARE! Do with it as you wish. It is yours
# to share and enjoy. Modify it, improve it, and have fun with it!
# It is distributed strictly as a learning aid and bignosebird.com
# disclaims all warranties- including but not limited to:
# fitness for a particular purpose, merchantability, loss of
# business, harm to your system, etc... ALWAYS BACK UP YOUR
# SYSTEM BEFORE INSTALLING ANY SCRIPT OR PROGRAM FROM ANY
# SOURCE!
##################################################################

# CONFIGURATION NOTES

#
# $SCRIPT_NAME is the full URL of this script, including the
# http part, ie, "http://domainname.com/cgi-bin/birdcast.cgi";
#
# $SITE_NAME is the "name" of your web site.
# $SITE_URL is the URL of your site (highest level)
# $END_LINE is the very last line printed in the e-mail.
#
# $MAXNUM is the number of possible people a person can refer
# your URL to at one time. If you call the script using the
# GET method, then this is also the number of entry blanks
# created for recipient names and addresses.
#
# $SMTP_SERVER is the name of your e-mail gateway server, or
# SMTP host. On most systems, "localhost" will work just fine.
# If not, change "localhost" to whatever your ISP's SMTP
# server name is, ie, smtp.isp.net or mail.isp.net

# $SEND_MAIL is the full path to your server's sendmail program
# If you do not wish to use Sockets for some reason and need
# to use sendmail, uncomment the $SEND_MAIL line and comment
# the $SMTP_SERVER line.

# okaydomains is a list of domains from which you want to allow
# the script to be called from. Leave it commented to leave the
# script unrestricted. If you choose to use it, be sure to list
# your site URL with and without the www.

# Use either $SMTP_SERVER
# $SMTP_SERVER="localhost";
#
# OR
#
$SEND_MAIL="/usr/sbin/sendmail -t";
$book_header = "link.txt";
$book_footer = "message.txt";

#
# BUT NEVER BOTH!!!!!!

# @okaydomains=("http://yourdomain.com", "http://www.yourdomain.com");

$SCRIPT_NAME="http://searchat.virtualave.net/cgi-bin/links/birdcast2.cgi";
$SITE_NAME="SearchAt!";
$SITE_URL="http://searchat.virtualave.net/";
$ENDLINE="";
$MAXNUM=5;
$LOGFILE="reflog.txt";

if ($SENDMAIL ne "")
{&test_sendmail;}


&valid_page; #if script is called from offsite, bounce it!
&decode_vars;
%rec = &get_record($fields{'ID'});
if ($ENV{'REQUEST_METHOD'} ne "POST")
{
&draw_request;
exit;
}
&do_log;
&process_mail;
print "Location: $JUMP_TO\n\n";

##################################################################
sub process_mail
{
my $carbon = "Bcc: searchat\@2xtreme.net";
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}

#BNB SAYS! You can modify the Subject line below.

$subject = "Web Link Suggestion from $fields{'send_name'}";

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;
Hi $fields{$recipname},

$fields{'send_name'} stopped by $SITE_NAME
and suggested that you visit the following URL:

Site Name: $rec{'Title'}
Site Location: $rec{'URL'}
Site Description: $rec{'Description'}
__STOP_OF_MAIL__





if ($fields{'message'} ne "")
{
$msgtxt .= "Here is a personal message from $fields{'send_name'}....\n";
$msgtxt .= "--------------------------------------\n\n";
$msgtxt .= "$fields{'message'}\n\n";
$msgtxt .= "--------------------------------------\n\n";

}
$msgtxt .= "$SITE_NAME\n";
$msgtxt .= "$ENDLINE\n";
$msgtxt .= "$SITE_URL\n\n";
$mailresult = &sendmail(
$fields{send_email},
$fields{send_email},
$fields{$recipemail},
$SMTP_SERVER,
$subject,
$msgtxt,
$carbon
);


if ($mailresult ne "1")
{print "Content-type: text/html\n\n";
print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
exit
}

}
}

##################################################################
sub draw_request
{
print "Content-type: text/html\n\n";

#BNB SAYS! Here is the part that draws the page that asks the
#reader to enter e-mail addresses and names. Tailor it to meet
# your needs if necessary. DO NOT disturb the lines with
# __REQUEST__ on them.

print <<__REQUEST__;
<BODY BGCOLOR="../../bck-110.jpg">
<CENTER>

<P>
<TABLE WIDTH=550 BGCOLOR="CCE6FF">
<TR>
<TD>
<FONT FACE="ARIAL" SIZE=4 COLOR="#009999">
<B>
<CENTER>
SUGGEST THIS LINK TO A FRIEND...<P>
$rec{'Title'} <BR>
$rec{'URL'} <BR>
$rec{'Description'}

</CENTER>
</B>
</FONT>
<BLOCKQUOTE>
<FONT FACE="ARIAL" SIZE=2 COLOR="#000000">
If you have a friend that you would like to recommend this page to,
or if you just want to send yourself a reminder, here is the easy
way to do it!
<P>
Simply fill in the e-mail address of the person(s) you wish to tell
about $SITE_NAME, your name and e-mail address (so they do
not think it is spam or reply to us with gracious thanks),
and click the <B>SEND</B> button.
If you want to, you can also enter a message that will be included
on the e-mail.
<P>
After sending the e-mail, you will be transported back to the
page you recommended!
</FONT>
<FORM METHOD="POST" ACTION="$SCRIPT_NAME">
<INPUT TYPE="HIDDEN" NAME="call_by" VALUE=$ENV{'HTTP_REFERER'}>
<input type="hidden" name="ID" value="$rec{'ID'}">
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 >
<TR>
<TD> </TD>
<TD ALIGN=CENTER><B>Name</B></TD>
<TD ALIGN=CENTER><B>E-Mail Address</B><TD>
</TR>
<TR>
<TD><B>You</B></TD>
<TD><INPUT TYPE="TEXT" NAME="send_name"></TD>
<TD><INPUT TYPE="TEXT" NAME="send_email"></TD>
</TR>
__REQUEST__
for ($i=1;$i<$MAXNUM+1;$i++)
{
print <<__STOP_OF_ROW__;
<TR>
<TD><B>Friend $i</B></TD>
<TD><INPUT TYPE="TEXT" NAME="recipname_$i"></TD>
<TD><INPUT TYPE="TEXT" NAME="recipemail_$i"></TD>
</TR>
__STOP_OF_ROW__
}
print <<__REQUEST2__;
<TR>
<TD> </TD>
<TD ALIGN=CENTER COLSPAN=2>
<B>Your Message</B><BR>
<textarea name="message" wrap=virtual rows=5 cols=35></textarea>
<BR>
<INPUT TYPE="submit" VALUE="SEND">
</TD>
</TR>
</TABLE>
</FORM>
</BLOCKQUOTE>
<CENTER>
<FONT SIZE="-1">
Free recommendation script created by<BR>
</FONT>
<A HREF="http://bignosebird.com/"><B>BigNoseBird.Com</B></A><BR>
<FONT SIZE="-1">
<I>The Strangest Name in Free Web Authoring Resources<I><BR>
</FONT>
<P>
</CENTER>
</TD>
</TR>
</TABLE>
__REQUEST2__
}

##################################################################
# NOTHING TO MESS WITH BEYOND THIS POINT!!!!
##################################################################
sub decode_vars
{
$i=0;
if ( $ENV{'REQUEST_METHOD'} eq "GET")
{
$temp=$ENV{'QUERY_STRING'};
}
else
{
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
}
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$content=~s/\012//gs;
$content=~s/\015/ /gs;
$fields{$key}=$content;
}
if ($fields{'call_by'} eq "")
{
$JUMP_TO = $ENV{'HTTP_REFERER'};
}
else
{
$JUMP_TO = $fields{'call_by'};
}
}

##################################################################
sub valid_address
{
$testmail = $fields{$recipemail};
if ($testmail =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
$testmail !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)
{
return 0;
}
else
{
return 1;
}
}

sub valid_page
{
if (@okaydomains == 0) {return;}
$DOMAIN_OK=0;
$RF=$ENV{'HTTP_REFERER'};
$RF=~tr/A-Z/a-z/;
foreach $ts (@okaydomains)
{
if ($RF =~ /$ts/)
{ $DOMAIN_OK=1; }
}
if ( $DOMAIN_OK == 0)
{ print "Content-type: text/html\n\n Sorry, cant run it from here....";
exit;
}
}


##################################################################
sub test_sendmail
{
@ts=split(/ /,$MAIL_PROGRAM);
if ( -e $ts[0] )
{
return;
}
print "Content-type: text/html\n\n";
print "<H2>$ts[0] NOTFOUND. PLEASE CHECK YOUR SCRIPT'S MAIL_PROGRAM VARIABLE</H2>";
exit;
}

sub do_log
{
(-e $LOGFILE) ?
open (ZL,">>$LOGFILE") :
open (ZL,">$LOGFILE");
$date=localtime(time);
for ($i=1;$i<$MAXNUM+1;$i++)
{
$recipname="recipname_$i";
$recipemail="recipemail_$i";
if ($fields{$recipemail} eq "")
{
next;
}
if (&valid_address == 0)
{
next;
}
$logline="$date\|$JUMP_TO\|$fields{'send_email'}\|$fields{$recipemail}\|\n";
print ZL $logline;
}
close(ZL);
}

###################################################################
#Sendmail.pm routine below by Milivoj Ivkovic
###################################################################
sub sendmail {

# error codes below for those who bother to check result codes <gr>

# 1 success
# -1 $smtphost unknown
# -2 socket() failed
# -3 connect() failed
# -4 service not available
# -5 unspecified communication error
# -6 local user $to unknown on host $smtp
# -7 transmission of message failed
# -8 argument $to empty
#
# Sample call:
#
# &sendmail($from, $reply, $to, $smtp, $subject, $message );
#
# Note that there are several commands for cleaning up possible bad inputs - if you
# are hard coding things from a library file, so of those are unnecesssary
#

my ($fromaddr, $replyaddr, $to, $smtp, $subject, $message, $carbon) = @_;

$to =~ s/[ \t]+/, /g; # pack spaces and add comma
$fromaddr =~ s/.*<([^\s]*?)>/$1/; # get from email address
$replyaddr =~ s/.*<([^\s]*?)>/$1/; # get reply email address
$replyaddr =~ s/^([^\s]+).*/$1/; # use first address
$message =~ s/^\./\.\./gm; # handle . as first character
$message =~ s/\r\n/\n/g; # handle line ending
$message =~ s/\n/\r\n/g;
$smtp =~ s/^\s+//g; # remove spaces around $smtp
$smtp =~ s/\s+$//g;

if (!$to)
{
return(-8);
}

if ($SMTP_SERVER ne "")
{
my($proto) = (getprotobyname('tcp'))[2];
my($port) = (getservbyname('smtp', 'tcp'))[2];

my($smtpaddr) = ($smtp =~
/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
? pack('C4',$1,$2,$3,$4)
: (gethostbyname($smtp))[4];

if (!defined($smtpaddr))
{
return(-1);
}

if (!socket(MAIL, AF_INET, SOCK_STREAM, $proto))
{
return(-2);
}

if (!connect(MAIL, pack('Sna4x8', AF_INET, $port, $smtpaddr)))
{
return(-3);
}

my($oldfh) = select(MAIL);
$| = 1;
select($oldfh);

$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-4);
}

print MAIL "helo $SMTP_SERVER\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

print MAIL "mail from: <$fromaddr>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-5);
}

foreach (split(/, /, $to))
{
print MAIL "rcpt to: <$_>\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-6);
}
}

print MAIL "data\r\n";
$_ = <MAIL>;
if (/^[45]/)
{
close MAIL;
return(-5);
}

}

if ($SEND_MAIL ne "")
{
open (MAIL,"| $SEND_MAIL");
}

print MAIL "To: $to\n";
print MAIL "From: $fromaddr\n";
print MAIL "$carbon\n";
print MAIL "Reply-to: $replyaddr\n" if $replyaddr;
print MAIL "X-Mailer: Perl Powered Socket Mailer\n";
print MAIL "Subject: $subject\n\n";
print MAIL "\n\n";
print MAIL "Content-type: text/html\n\n";
print MAIL "<html>\n";
print MAIL "\n";
print MAIL "<body bgcolor=\"#FFFFFF\" link=\"#04649C\" vlink=\"#007FFF\" alink=\"#800080\">\n";
print MAIL "\n";

print MAIL "$message";
print MAIL "</body>\n";
print MAIL "</html>\n";
print MAIL "\n";


if ($SMTP_SERVER ne "")
{
$_ = <MAIL>;
if (/^[45]/)
{
close(MAIL);
return(-7);
}

print MAIL "quit\r\n";
$_ = <MAIL>;
}

close(MAIL);
return(1);
}

Which I believe the send part is the last section. I have been beating my brains out trying to solve this, and I have just about givin up but I know someone out there knows the solution. Thanks in advance.



SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
I don't know why it is not working for you. It looks almost identical to mine. I attached my code to an email and sent it to you. Maybe you can see what is missing. They looked the same to me.

Jimmy Crow
http://www.homewithgod.com/
Quote Reply
Re: Text to html on Birdcast2.cgi In reply to
I just found out why it was printing text on my email.

If you look at the sub send email part of your code and my code at print MAIL "\n\n"; below print MAIL "Content-type: text/html\n\n"; and one other place in the same spot another extra \n for some reason made it print in text and now is printing in html.

Thank you jcrow for helping me. For this your search engine is listing in my directory without a requirement for a reciprocal link. I'll send you your password and details if you ever want to change anything.

SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net