PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Using the mail() function
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Using the mail() function

Réponse
 
LinkBack Outils de la discussion
Vieux 25/02/2008, 23h42   #1
techjohnny@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Using the mail() function

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
  Réponse avec citation
Vieux 25/02/2008, 23h51   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the mail() function

techjohnny@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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 26/02/2008, 00h04   #3
techjohnny@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the mail() function

On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> 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
  Réponse avec citation
Vieux 26/02/2008, 01h02   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the mail() function

techjohnny@gmail.com wrote:
> On Feb 25, 3:51 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> 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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 26/02/2008, 08h21   #5
Willem Bogaerts
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the mail() function

>>> $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/
  Réponse avec citation
Vieux 26/02/2008, 21h03   #6
lVlint67
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the mail() function

On Feb 26, 3:21 am, Willem Bogaerts
<w.bogae...@kratz.maardanzonderditstuk.nl> wrote:
> >>> $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/




$headers .= "FROM: $from \r\n"; //$from should be checked for
injection already

mail($to,$subject,$body,$headers); //the $to is the first argument
passed to mail()....
http://us.php.net/manual/en/function.mail.php
but you issues seemed to be string based.

//////
$a="a test string";

echo 'this is $a'; //this is $a
echo 'this is'.$a; //this is a test string
echo "this is $a"; //this is a test string
///////
' ' = literal.. the string is sent tot he browser as it appears in
code
" " = interpreted.. the string is processed, variables are
substituted out for their values
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h43.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,40784 seconds with 14 queries