By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Using the mail() function

P: n/a
I'd like to use the $headers field in the mail() function of PHP, but
I'd like to be able to make these variable that somebody could change
in a form.

$headers .= 'To: $to' . "\r\n";
Something like that above.

Thanks,

--TJ
Feb 25 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
te********@gmail.com wrote:
I'd like to use the $headers field in the mail() function of PHP, but
I'd like to be able to make these variable that somebody could change
in a form.

$headers .= 'To: $to' . "\r\n";
Something like that above.

Thanks,

--TJ
Which will open your site as a spam relay, and quickly get your hosting
account canceled.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Feb 25 '08 #2

P: n/a
On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
techjoh...@gmail.com wrote:
I'd like to use the $headers field in the mail() function of PHP, but
I'd like to be able to make these variable that somebody could change
in a form.
$headers .= 'To: $to' . "\r\n";
Something like that above.
Thanks,
--TJ

Which will open your site as a spam relay, and quickly get your hosting
account canceled.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Yeah, I realize that now. But, what about making one of the header
fields a variable? I just don't understand the php syntax well enough
to make this happen.

--JP
Feb 26 '08 #3

P: n/a
te********@gmail.com wrote:
On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>techjoh...@gmail.com wrote:
>>I'd like to use the $headers field in the mail() function of PHP, but
I'd like to be able to make these variable that somebody could change
in a form.
$headers .= 'To: $to' . "\r\n";
Something like that above.
Thanks,
--TJ
Which will open your site as a spam relay, and quickly get your hosting
account canceled.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Yeah, I realize that now. But, what about making one of the header
fields a variable? I just don't understand the php syntax well enough
to make this happen.

--JP
Read up on single and double quoting strings, for starters. You need
either:

$headers .= "To: $to\r\n";

Or

$headers .= 'To: ' . $to . "\r\n";

Variables are not replaced when in single quotes.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Feb 26 '08 #4

P: n/a
>>$headers .= 'To: $to' . "\r\n";
>>Something like that above.
>Which will open your site as a spam relay, and quickly get your hosting
account canceled.
Yeah, I realize that now. But, what about making one of the header
fields a variable? I just don't understand the php syntax well enough
to make this happen.
First thing to read about is mail injection. If you don't read up on
that, your site will STILL be a spam relay.

Good luck,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Feb 26 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.