i trying build form submit copy form owner , user. when try insert fifth variable mail() seems if last of variables stops working:
if( empty($errors)) { $to = $email_address; //user email $email_subject = "some text"; $email_body = "more text"; $from = "from: $myemail \n"; //form owner email $headers = "bcc:" . $myemail; mail($to,$email_subject,$email_body,$from,$headers); header("location: $where"); }
leaving out $from copy of mail sent both user , form owner, no possibility control "from"-field of email - leaving out $header form owner don't receive copy. if possible both.
i apologize in advance simplicity of question - know php (and web dev in general) i've picked clever guys on fora such this.
regards
these correct parameters mail:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
as can see, 4th parameter not "from", headers string.
try example below:
<?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'from: webmaster@example.com' . "\r\n" . 'reply-to: webmaster@example.com' . "\r\n" . 'x-mailer: php/' . phpversion(); mail($to, $subject, $message, $headers);
you put from, cc, bcc etc fields in headers.
Comments
Post a Comment