Re: PHP Email Question
am 01.10.2010 00:37:40 von Ravi MenonOn Wed, Sep 29, 2010 at 1:37 PM, Joe Jackson
te:
> Hi
>
> I am trying the following snippet as Bostjan=A0 suggested, and an email i=
s
> getting sent when I submit the form however in the body of the email I am
> getting none of the form data in the body of the email.=A0 All I am getti=
ng is
> the letter 'z' ?=A0 Also in the from field of the email this is showing a=
s my
> email address and not the email address of the user who has sent the form
>
> Any ideas on where I am going wrong with this snippet?=A0 Any advice woul=
d be
> much appreciated
>
> $msgContent =3D "Name: ". $values['name'] ."\n";
> $msgContent .=3D "Address: ". $values['address'] ."\n";
> $msgContent .=3D "Telephone: ". $values['telephone'] ."\n";
> $msgContent .=3D "Email Address: ". $values['emailaddress'] ."\n";
> $msgContent .=3D "Message: ". $values['message'] ."\n";
>
> function ProcessForm($values)
> {
> =A0 mail('myemail:domain.com', 'Website Enquiry', $msgContent, "Fro=
m:
> \"{$values['name']}\" <{$values['emailaddress']}>");
>
> // Replace with actual page or redirect :P
> =A0 echo "
> you!";
Not sure if it it is a typo above, are you actually passing
$msgContent in the function above? If it is a global variable, you
would need to add a 'global' declaration:
function ProcessForm($values)
{
global $msgContent;
mail('myemail:domain.com', 'Website Enquiry', $msgContent, "From:
\"{$values['name']}\" <{$values['emailaddress']}>\r\n");
..
..
..
}
Also try adding CRLF sequence at the end of the header line as shown above.
Ravi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php