> Ignore the other parameters unless you are very familiar with RFCs 2821, > 2822 and their associated RFCs > I would advise against ignoring the other parameters. Doing so will pretty much guarantee having your email end up in SPAM. Instead look up the examples in the docs, or better yet use something like phpmailer as Tom suggested. Chris. On Sun, Sep 19, 2010 at 6:37 PM, TR Shaw <tshaw@xxxxxxxx> wrote: > > On Sep 19, 2010, at 6:00 PM, Joe Jackson wrote: > > > Hi > > > > Sorry for the simple question but I am trying to get my head around PHP. > I > > have a sample PHP script that I am trying to use to send a php powered > email > > message. The snippet of code is shown below.... > > > > mail('email@xxxxxxxxxxx', 'Subject', $values['message'], "From: > > \"{$values['name']}\" <{$values['emailaddress']}>"); > > > > This works fine, but how can I add in other fields to the email that is > > recieved? > > > > For example in the form there are fields called, 'emailaddress', > > 'telephone', 'address' and 'name' which I need to add into the form along > > with the message field > > > > Also with the formatting how can I change the format of the email to > > > > Name: $values['name'], > > Address: etc > > Message: > > > > Joe > > The mail command lets you send mail (an RFC2821 envelop). The function is: > > bool mail ( string $to , string $subject , string $message [, string > $additional_headers [, string$additional_parameters ]] ) > > $to is where you want it to go > $subject is whatever you want the subject to be > $message is the information you want to send Ignore the other parameters unless you are very familiar with RFCs 2821, > 2822 and their associated RFCs > So if you want to send info from a form you might want to roll it up in xml > and send it via the message part. when you receive it you can easily decode > it. If you don't want to do that put it in a format that you can easily > decode on the receiving end. > > Basically "mail" is a way to deliver information in the $message body. How > you format the information there is up to you. However, depending on your > system's config you are probably constrained to placing only 7bit ascii in > the $message body. > > You might also move away from the mail function and look at phpmailer at > sf.net if you need more complex capabilities. > > Tom > > > >