473,473 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checking the 'message' parameter of the mail function

I would imagine it is a fairly common situation for a site to allow the
user to enter some text into a field and then to have that text passed
to the 'message' parameter of the mail function
(http://us4.php.net/manual/en/function.mail.php).

Is it a good idea to pass this text through some other function first or
can it be sent through as is? Is this a case where the maxim 'do not
trust input from the user' does not apply?
Jul 17 '05 #1
3 1410
I would usually make my own function to remove any potentially harmful text
like html characters before including it in an email message. Sterlizing
user input is most always a necessity.

"Eric" <eg******@verizon.net> wrote in message
news:1ghca1j.1m4i6r81wy2qdcN%eg******@verizon.net. ..
I would imagine it is a fairly common situation for a site to allow the
user to enter some text into a field and then to have that text passed
to the 'message' parameter of the mail function
(http://us4.php.net/manual/en/function.mail.php).

Is it a good idea to pass this text through some other function first or
can it be sent through as is? Is this a case where the maxim 'do not
trust input from the user' does not apply?

Jul 17 '05 #2
C.Schneck <ch***@nisa.com> wrote:
"Eric" <eg******@verizon.net> wrote in message
news:1ghca1j.1m4i6r81wy2qdcN%eg******@verizon.net. ..
I would imagine it is a fairly common situation for a site to allow the
user to enter some text into a field and then to have that text passed
to the 'message' parameter of the mail function
(http://us4.php.net/manual/en/function.mail.php).

Is it a good idea to pass this text through some other function first or
can it be sent through as is? Is this a case where the maxim 'do not
trust input from the user' does not apply?


I would usually make my own function to remove any potentially harmful text
like html characters before including it in an email message. Sterlizing
user input is most always a necessity.


Surely such functions must exist in great abundance...do you happen to
have one hanging around somewhere?

Jul 17 '05 #3
i post this one a lot, htmlspecialchars() its really handy.

also depending on your php configuration addslashed() is another one you
could consider.

"Eric" <eg******@verizon.net> wrote in message
news:1ghdfs6.twyiyg12dpkgkN%eg******@verizon.net.. .
C.Schneck <ch***@nisa.com> wrote:
"Eric" <eg******@verizon.net> wrote in message
news:1ghca1j.1m4i6r81wy2qdcN%eg******@verizon.net. ..
I would imagine it is a fairly common situation for a site to allow the user to enter some text into a field and then to have that text passed
to the 'message' parameter of the mail function
(http://us4.php.net/manual/en/function.mail.php).

Is it a good idea to pass this text through some other function first or can it be sent through as is? Is this a case where the maxim 'do not
trust input from the user' does not apply?


I would usually make my own function to remove any potentially harmful text like html characters before including it in an email message. Sterlizing
user input is most always a necessity.


Surely such functions must exist in great abundance...do you happen to
have one hanging around somewhere?

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tongu? Yumruk | last post by:
I have a little proposal about type checking in python. I'll be glad if you read and comment on it. Sorry for my bad english (I'm not a native English speaker) A Little Stricter Typing in Python...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
14
by: sathya_me | last post by:
Dear clc, I have a variable void *a; Since variable "a" can be assigned (point to) any type and also any type can be assigned to "a" (i.e means "a" = any typed variable; any typed variable =...
5
by: Ram | last post by:
Hi Friends I want to develope a custom control in .net which can be used with any project. I am writing a function in that class which I want to take any object as parameter. For that I have...
10
by: Fredrik Tolf | last post by:
If I have a variable which points to a function, can I check if certain argument list matches what the function wants before or when calling it? Currently, I'm trying to catch a TypeError when...
4
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
1
by: halcyon943 | last post by:
have 4 folders that I watch and need to move files from to another location. Three constraints: -Finish time. Make sure the program stops transferring files at a specific time -Number of...
8
by: aarklon | last post by:
Hi all, see:- http://linuxgazette.net/issue51/pramode.html
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.