Re: PHP Email Question

Re: PHP Email Question

am 01.10.2010 00:37:40 von Ravi Menon

On Wed, Sep 29, 2010 at 1:37 PM, Joe Jackson wro=
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 "Thank you!Thank
> 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

Re: PHP Email Question

am 01.10.2010 17:06:19 von kranthi

I cant see why you are getting the letter 'z' (assuming $msgContent
was referenced properly) . Complete code will be helpful to debug the
problem.

Also, Heredoc syntax will be more helpful in your situation. And usage
of global keyword is strongly discouraged in favor of $GLOBALS
superglobal array

http://php.net/GLOBALS
http://php.net/heredoc

Kranthi.
http://goo.gl/e6t3

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php