php-general Digest 20 Sep 2010 11:35:25 -0000 Issue 6950

Topics (messages 308199 through 308201):

Re: PHP Email Question
        308199 by: Bostjan Skufca
        308200 by: TR Shaw
        308201 by: Joe Jackson

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin 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('em...@address.com', 'Subject', $msgContent, "From...);

b.


On 20 September 2010 00:00, Joe Jackson <priory...@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('em...@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
>

--- End Message ---
--- Begin Message ---
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('em...@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:
> 

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




--- End Message ---
--- Begin Message ---
Hi

All I need is in the message body of the email is to include more data from
the form.  At present it only displays the 'message' field value in the body
of the email.  I need to add further information into the email from the
form such as 'address' 'name' and 'telephone number'
When I have tried to add them into the PHP script

 $values['message'], ['name'], ['address'], ['telephonenumber'],

I am getting PHP errors, what would be the correct syntax I would need to
use to get the following form field values into the email body.

I greatly appreciate all your expert advice and help.


On Sun, Sep 19, 2010 at 11:37 PM, TR Shaw <ts...@oitc.com> 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('em...@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:
>
>
> 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
>
>
>
>

--- End Message ---

Reply via email to