Re: PHP Email Question
| From: | Bostjan Skufca | Date: | Sun, 19 Sep 2010 22:29:51 +0000 |
| Subject: | Re: PHP Email Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308199@lists.php.net to get a copy of this message | ||
You should format the email message content first, like this:
$msgContent = "Name: ". $values['name'] ."\n";
$msgContent .= "Address: ". $values['address'] ."\n";
Then you should send a this content, like this:
mail('email@address.com', 'Subject', $msgContent, "From...);
b.
On 20 September 2010 00:00, Joe Jackson <priorybar@googlemail.com> 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@address.com', '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:
>
> TIA
>