Click to See Complete Forum and Search --> : sending email through sendmail
druss
06-18-2003, 03:06 AM
the email i send works fine, the subject field actually can have spaces, the content can be sent as html also. However the problem is that i cannot make the from field to show up as 'Make Me Laugh' instead it shows up as 'Make.Me.Laugh@server1.maxipointservers.net ' this looks awfull and i cant seem to get it to work
Any help is welcomed :)
thanks
Goran
You mean you're naming your form field Make Me Laugh? That's not acceptible. You shouldn't have spaces in your form field names. Instead name it, Make_Me_Laugh.
Jona
jeffmott
06-18-2003, 08:05 PM
i cannot make the from field to show up as 'Make Me Laugh' instead it shows up as 'Make.Me.Laugh@server1.maxipointservers.net 'This is generally done by putting the text you want to appear in parentheses after the e-mail. e.g.,Make.Me.Laugh@server1.maxipointservers.net (Make Me Laugh)That's not acceptible. You shouldn't have spaces in your form field names...why not?
Originally posted by jeffmott
...[W]hy not?
I came on a little strong. Maybe I should've said, "It's a good practice not to use spaces in your form names," or something like, "I STRONGLY SUGGEST you do not use spaces in your form names." :D
Jona
jeffmott
06-19-2003, 07:45 AM
I STRONGLY SUGGEST you do not use spaces in your form names....why not? :p
Really, though. So long as you keep it quoted in your HTML, there shouldn't be any problem. Unless there's a situation I'm not aware of where it would create conflicts. :confused:
Not sure how it works in Perl, but in PHP, if you use spaces in your form names, you just need to be sure you reference them as a string literal. So this:
<input type="text" name="my test">
would have to be referenced like this:
$_POST['my test'];
as apposed to
$_POST["my test"];
Originally posted by jeffmott
...[W]hy not? :p
It's a very good practice not to--a lot of times you can get confused because of the way you name your form elements. 'Twas just a suggestion--a strong one at that. ;)
Jona
jeffmott
06-19-2003, 01:33 PM
$_POST['my test'];
as apposed to
$_POST["my test"];The quotes make a difference with a space? :confused:
It was my understanding that the two forms of quotes changes only the interpretation of variables and escape sequences to be interpolated.
Yes, actually, I'm not entirely sure why it makes a difference either. Single quotes are used when you need to treat variables and special characters (a space?) literally, whereas double quotes are used to reference the value of the items.
For instance:
$variable = "test";
echo "$variable"; # will echo test
echo '$variable'; # will echo $variable
I'm assuming a space is considered a special character, and that is why single quotes are necessary.
jeffmott
06-19-2003, 02:44 PM
and that is why single quotes are necessaryI'm assuming you've tested this? Because I don't see how space would be treated as a special character.
echo "hello world"; seems to do the same as
echo 'hello world';
Yeah, I did test it but didn't save my code, and now I can't get it to work with single or double quotes. :rolleyes:
Anyway, in the situation you posted, they do indeed echo the same thing.
jeffmott
06-19-2003, 09:37 PM
Ahh, I see where the problem is.<?php
foreach($_REQUEST as $key => $value) {
echo "$key -> $value<br>";
}
?>
<form action="page.php" method="get">
<input name="my test"><br>
<input type="submit">
</form>It seems PHP converts spaces to underscore. This does also mean that if you have two fields named "my test" and "my_test" (unlikely, but possible) what should be two different fields is then treated as the same field.
Hmm... You're right. Wonder if it's a bug, or if was simply overlooked... I'm assuming Perl handles them correctly?
jeffmott
06-19-2003, 10:00 PM
It must be something they chose to do deliberately for some reason. Decoding a "+" into an underscore instead of a space for only the names seems a little hard to believe was a casual mistake.
Yes, Perl... that is the standard Perl library file for handling CGI parameters, will retain the space. What is also nice is that if it didn't, you could go in and change it or just use a different library file.
druss
06-22-2003, 02:26 AM
ok, i didnt explain myproblem properly. When i review my test email it doesnt show what i entered the script to print. here is the script.
$admin_email = "Make Me Laugh";
print MAIL <<END;
To: $names[1]
From: $admin_email
Subject: $subject
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="$boundary"
--$boundary
Content-Type: text/html
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
END
it doesnt print out Make Me Laugh as the variable is. Rather it prints out the Make.Me.Laugh@serverpoint.com stuff.
I cannot make it appear with just the name rather than the whole email address
Thanks Again
Goran
jeffmott
06-22-2003, 07:27 AM
$admin_email = "Make Me Laugh";This would probably have to be $admin_email = 'Make.Me.Laugh@serverpoint.com (Make Me Laugh)';