spewn
Programmer
- May 7, 2001
- 1,034
hello.
i've been at this all night, and i can't get it right.
i'm using AJAX, and i'm taking information from a form on an html page, a textarea to be specific.
the information in the TA gets formatted into a query string, then passed to a script which i parse and put the value in the subject area of the sendmail.
problem is, i can't seem to pass carriage returns.
here's my code:
if i were to put the string "here we have\na sentence or two.\n\nsincerely,\nadministrator" it comes out in the email fine. but trying to pass the same sentence, complete with new lines from a variable, it prints the new lines literally.
i've tried unescaping the parameter:
$emsg = uri_unescape($emsg);
but that doesn't work either.
any ideas?
- g
i've been at this all night, and i can't get it right.
i'm using AJAX, and i'm taking information from a form on an html page, a textarea to be specific.
the information in the TA gets formatted into a query string, then passed to a script which i parse and put the value in the subject area of the sendmail.
problem is, i can't seem to pass carriage returns.
here's my code:
Code:
script.pl?a=test%20subject&b=here%20we%20have%5Cna%20sentence%20or%20two%5Cn%5Cnsincerely,%5Cnadministrator
$esub=param('a');
$emsg=param('b');
open (MAIL, "|/usr/sbin/sendmail -t") || return 0;
select (MAIL);
print << "EOF";
To: Joe Blow <jb\@joeblow.com>
From: Administrator <admin\@mysite.com>
Subject: $esub
$emsg
EOF
close (MAIL);
select (STDOUT);
if i were to put the string "here we have\na sentence or two.\n\nsincerely,\nadministrator" it comes out in the email fine. but trying to pass the same sentence, complete with new lines from a variable, it prints the new lines literally.
i've tried unescaping the parameter:
$emsg = uri_unescape($emsg);
but that doesn't work either.
any ideas?
- g