Re: PHP Email Question

From: Date: Thu, 30 Sep 2010 22:37:40 +0000
Subject: Re: PHP Email Question
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-308378@lists.php.net to get a copy of this message
On Wed, Sep 29, 2010 at 1:37 PM, Joe Jackson <priorybar@googlemail.com> wrote: > Hi > > I am trying the following snippet as Bostjan  suggested, and an email is > 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.  All I am getting is > the letter 'z' ?  Also in the from field of the email this is showing as 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?  Any advice would be > much appreciated > > $msgContent = "Name: ". $values['name'] ."\n"; > $msgContent .= "Address: ". $values['address'] ."\n"; > $msgContent .= "Telephone: ". $values['telephone'] ."\n"; > $msgContent .= "Email Address: ". $values['emailaddress'] ."\n"; > $msgContent .= "Message: ". $values['message'] ."\n"; > > function ProcessForm($values) > { >     mail('myemail:domain.com', 'Website Enquiry', $msgContent, > "From: > \"{$values['name']}\" <{$values['emailaddress']}>"); > >      // Replace with actual page or redirect :P >     echo "<html><head><title>Thank > you!</title></head><body>Thank > you!</body></html>"; 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

« previous php.general (#308378) next »