Bob Stone
asked on
Emial cgi messed up
I got a prob with this script. It attaches the message to the end of the subject line. It used to work but I edited some stuff and must have messed it up somehow. I wrote this but my knowledge of perl/cgi came out a book and this is one of 3 scripts I've ever written.
#!/usr/local/bin/perl
use CGI ':standard';
sub send_mail {
my($to, $return, $subject, @body)=@_;
open MAIL, "|/usr/vde/bin/sendmail -t";
print MAIL "To: $to\n";
print MAIL "Reply-to: $return\n";
print MAIL "From: $return\n";
print MAIL "Subject: $subject\n - (IP# $theirIPAddress )";
foreach(@body) {
print MAIL "$_\n";
}
close(MAIL);
}
$theirIPAddress=$ENV{'REMO TE_ADDR'};
print header, start_html;
@body=param('body');
if(param('target'))
{
send_mail(param('target'), param('return'), param('subject'), @body);
}
#!/usr/local/bin/perl
use CGI ':standard';
sub send_mail {
my($to, $return, $subject, @body)=@_;
open MAIL, "|/usr/vde/bin/sendmail -t";
print MAIL "To: $to\n";
print MAIL "Reply-to: $return\n";
print MAIL "From: $return\n";
print MAIL "Subject: $subject\n - (IP# $theirIPAddress )";
foreach(@body) {
print MAIL "$_\n";
}
close(MAIL);
}
$theirIPAddress=$ENV{'REMO
print header, start_html;
@body=param('body');
if(param('target'))
{
send_mail(param('target'),
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
maneshr,
I haven't the time here. If you do, I think there were references in EE for some threads that were discussing legal characters for recipient ("to: ___").
I haven't the time here. If you do, I think there were references in EE for some threads that were discussing legal characters for recipient ("to: ___").
<ugh> forgot to leave.
Check out example within last visible open q: on the Topic page:
https://www.experts-exchange.com/cgi/Q.20254607.html
- a couple examples of the syntax for double <CR>'s therein... my ref:
\n\n
terminator (multiline)
Check out example within last visible open q: on the Topic page:
https://www.experts-exchange.com/cgi/Q.20254607.html
- a couple examples of the syntax for double <CR>'s therein... my ref:
\n\n
terminator (multiline)
ASKER
I replaced;
print MAIL "Subject: $subject\n - (IP# $theirIPAddress )";
with this;
print MAIL "Subject: $subject - (IP# $theirIPAddress )\n";
and it worked perfectly. Just forgot to close the line or whatever you call it.
print MAIL "Subject: $subject\n - (IP# $theirIPAddress )";
with this;
print MAIL "Subject: $subject - (IP# $theirIPAddress )\n";
and it worked perfectly. Just forgot to close the line or whatever you call it.
stone5150,
"..and it worked perfectly...."
Excellent!!!
"..Just forgot to close the line or whatever you call it. .."
Glad to know you got the solution you were looking for.
"..and it worked perfectly...."
Excellent!!!
"..Just forgot to close the line or whatever you call it. .."
Glad to know you got the solution you were looking for.
As I understand it, today, this is rfc issue, not perl. The subject being variable length field requiring special terminator.
I think by 'special', in olden times it was xMit (KB) of two nulls by hitting return twice. So in C or Perl, I'd try first
\n\n
since it is quick, then go look it up (rfc)(or Perl script support site) to see if it was supposed to be real null character or perhaps only a single period on line followed by <cr>
I think it is suggested at about 68 char limit for subject, and 'should be' one single visible line, that can be parsed/scrolled to next/multi-line. With another suggestion for real max
If you don't get far but do get impatient, let me know and I'll check/see if I preserved some of those bookmarks.