Gossamer Forum
Home : Products : DBMan : Discussions :

Re: Formatting question

Quote Reply
Re: Formatting question In reply to
Thanks!

This works just like I wanted it to! However... :) I also want to use it for the Private Emailer Mod (a sendmail like mod within DB Man) and cant get it to work.

I thought I would be able to use the same code at top of sub send_email, but it just gets "ignored"...

sub send_email {
# --------------------------------------------------------
# This subroutine added for the private email mod
#

$descr = $in{'emailmessage'};
$descr =~ s/\s+/ /g;
$descr =~ /^\s+(.+)$/ ? ($descr = $1) : ($descr = $descr);
@words = split(/\s/,$descr);

foreach (@words) {
unless ($_ =~ /^\S{1,25}$/) {
push(@input_err, "$col <font face=arial,verdana,helvetica,sans serif size=2
color=ce0000><b>You have words that are too long in your description field.
You are not allowed to enter words that are longer than 25 characters in length. Check
your Description field and shorten any words that are to long.</b>");
last;
}
}

unless ($in{'email'}) { $message = ".<BR>"; }
unless ($in{'email'} =~ /.+\@.+\..+/) { $message = "Your email address is incorrect.<BR>"; }
unless ($in{'subject'}) { $message .= "You must fill in a subject for your message.<BR>"; }
unless ($in{'emailmessage'}) { $message .= "You must enter a message.<BR>"; }
%rec = &get_record($in{$db_key});
if (!%rec) { $message .= "The email address you requested could not be found.<BR>"; }
elsif (!$rec{$db_email_field}) { $message .= "There is no email address on file for this person.<BR>" }
if ($message) {
chomp($message);
&html_send_email_form($message);
return;
}
open (MAIL, "$mailprog") || &cgierr("unable to open mail program");
print MAIL "To: $rec{$db_email_field}\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: $in{'subject'}\n";
print MAIL "Content-Type: Text/Html\n\n";
print MAIL "<HTML><DIV>\n";
$in{'emailmessage'}=~s/\n/
/g;
print MAIL $in{'emailmessage'};
print MAIL "</DIV></HTML>";
close (MAIL);
&html_send_email_success;
}


Subject Author Views Date
Thread Formatting question eric74 4420 Jul 11, 2001, 4:50 AM
Thread Re: Formatting question
Paul 4346 Jul 11, 2001, 6:11 AM
Thread Re: Formatting question
eric74 4338 Jul 11, 2001, 7:55 AM
Thread Re: Formatting question
Paul 4346 Jul 11, 2001, 8:15 AM
Thread Re: Formatting question
AstroBoy 4356 Jul 11, 2001, 8:13 PM
Thread Re: Formatting question
eric74 4302 Jul 30, 2001, 2:40 PM
Thread Re: Formatting question
Paul 4280 Jul 30, 2001, 6:32 PM
Thread Re: Formatting question
lanerj 4265 Jul 31, 2001, 4:46 AM
Thread Re: Formatting question
Paul 4269 Jul 31, 2001, 5:05 AM
Post Re: Formatting question
lanerj 4256 Jul 31, 2001, 5:46 AM
Post Re: Formatting question
eric74 4250 Jul 31, 2001, 2:40 PM
Post Re: Formatting question
eric74 4258 Jul 31, 2001, 2:44 PM