html - PHP script not sending/receiving email -
i have site form suppose send email company , user filled out form. have loaded site of additional files server, when fill out form test error pops saying "not found". using method of php handle it. new php, , web design in general. thank you.
<?php //function sends email person submitted form function send_email(){ //this sends email person submitted form // email fields: to, from, subject. put values here! $sendermail = 'company@email.com'; $from = "company<".$sendermail.">"; $to = $_get['email']; $subject = 'product information'; $message = "a member of our sales team getting shortly. thank interest in our great line of products."."\n\n"."best regards,"."\n\n"."the team"; $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/plain; charset=iso-8859-1' . "\n"; $headers .= 'from: '. $from . "\r\n" . 'reply-to: '. $sendermail. "\r\n" . 'x-mailer: php/' . phpversion(); $ok = @mail($to, $subject, $message, $headers); //this sends contents of form submission website owner $sendermail2 = $_get['email']; $from2 = $_get['first-name'].' '.$_get['last-name'].' <'.$sendermail2.'>'; $to2 = 'company@email.com'; $subject2 = 'a customer submission product page'; $message2 = "name: ". $_get['first-name'] ." ". $_get['last-name'] ."\n\n". "company: ". $_get['company'] ."\n\n". "email: ". $_get['first-name'] ."\n\n". "interest: ".$_get['interest']; $headers2 = 'mime-version: 1.0' . "\r\n"; $headers2 .= 'content-type: text/plain; charset=iso-8859-1' . "\n"; $headers2 .= 'from: '. $from2 . "\r\n" . 'reply-to: '. $sendermail2. "\r\n" . 'x-mailer: php/' . phpversion(); $ok2 = @mail($to2, $subject2, $message2, $headers2); } return send_email(); ?> ...and code in body of html page.
<form action="http://www.server.com/html/form_process.php" method=get>
solution red hat server:
sudo yum install postfix subsequently:
sudo echo "sendmail_from = me@example.com" >> /your/directory/php.ini and finally:
sudo echo "sendmail_path = /usr/sbin/sendmail -t -i -f me@example.com" >> /your/directory/php.ini replace /your/directory/php.ini real php.ini directory , me@example.com email address want , restart apache, php , postfix, or directly server.
Comments
Post a Comment