[Eug-lug] PHP Mail Object - syntax for 'To' or 'CC' fields

Ben Barrett stircrazyben at gmail.com
Wed Nov 22 13:53:26 PST 2006


Right -- I've used mail() recently, see
http://us2.php.net/manual/en/ref.mail.php
it does everything you need and the package or library you're having trouble
with is likely just a wrapper for it.
I'm not familiar with what you mentioned -- is it a PEAR lib?

And I'll second Larry's advice, lock down your mail forms to avoid
spoofing/abuse.  If you have any hidden form elements that don't change,
they should prolly not be in the form at all -- or merely overridden by the
following PHP (although leaving a non-used hidden form element might
frustrate someone who is trying to abuse it, it will also frustrate the next
coder who tries to work on the script(s) :)

all the best,

    Ben


On 11/22/06, larry price <laprice at gmail.com> wrote:
>
> What does the documentation for Mail::factory say?
>
> I'm just guessing here but are the keys to the dictionary you are
> passing to the Mail object case-sensitive?
>
> http://pear.php.net/reference/Mail-1.1.3/Mail/Mail.html
>
> doesn't say.
>
> You don't have magic_quotes turned on in your php.ini do you, that can
> sometimes mess things up.
>
>
> I'm hoping that you are sanitizing the input variables somewhere else,
> since it would be easy for someone to pass a POST variable with
>
> in_to=3D\r\nCc: gran101 at aol.com,gran102 at aol.com,gran103 at aol.com\r\n\r\nLow
> Mortgage R8z ReFi
>
> Just because your form specifies an option does not mean that only
> options specified will be sent. liberal use of stripslashes() helps a
> lot.
>
>
> On 11/22/06, Matthew Jarvis <mattj at bikefriday.com> wrote:
> > Today's struggle is wrestling with an old program to get it to CC
> > someone when it sends out emails.
> >
> > User is in a form, selects "From" and "To". Enters text into a text box.
> > Hits the Send button. This all works.
> >
> > Trying to CC our Service manager on these things and can't get it to
> work.
> >
> > Here's a cut of the code:
> >
> >
> >          if (isset($in_body))
> >          {//save the note then close this screen
> >             $in_body =3D $in_who . ':   ' . $in_body;
> >             $headers['From']    =3D $in_who;
> >
> >             //$headers['To']      =3D $in_to . ',myusert at bikefriday.com=
';
> >             $headers['To']      =3D $in_to;    //this is the original l=
ine
> >
> >             $headers['CC']      =3D "myusert at bikefriday.com";
> >
> >             $headers['Subject'] =3D $in_subject;
> >             //$params ['sendmail_path'] =3D '/usr/lib/sendmail';
> >             $params ['host'] =3D "whatever.com";
> >             $params ['port'] =3D 25;
> >             $params ['auth'] =3D false;
> >             $params ['username'] =3D '';
> >             $params ['password'] =3D '';
> >             $mail_object =3D& Mail::factory('smtp', $params);
> >             $mail_object->send($in_to,$headers,$in_body);
> >             echo ('<script LANGUAGE=3D"JAVASCRIPT">');
> >             echo ('close();');
> >             echo ('</script>');
> >          }
> >
> >
> > I've left some snippets in there as examples of what I've been trying,
> > such as appending an email addy to the "To" param, stuffing it in the
> > 'CC' of the header, etc.
> >
> > The code for the Mail.php says that if addy's come in in a comma
> > seperated list that it parses them out.
> >
> > No joy....
> >
> > Any help out there?
> >
> > --
> > Matthew S. Jarvis
> > IT Manager
> > Bike Friday - "Performance that Packs."
> > www.bikefriday.com
> > 541/687-0487 x140
> > mattj at bikefriday.com
> > _______________________________________________
> > EUGLUG mailing list
> > euglug at euglug.org
> > http://www.euglug.org/mailman/listinfo/euglug
> >
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://euglug.org/pipermail/euglug/attachments/20061122/bc791f89/attac=
hment-0001.htm


More information about the EUGLUG mailing list