Search the Community
Showing results for tags '$sendemail'.
-
I have a php script that emails a completed order form linked to the script and sends a coppy (cc) to the sender. It has worked for years, until last week - the hosting company now tells me I need to amend the script as it uses the sender's email address as the "from" address and the server now prevents emails with this format as it can contain a spoofed from address. This is the script: <?php $file = $_POST['file']; $company = $_POST['company']; $ordered = $_POST['ordered']; $email = $_POST['email']; $date = $_POST['date']; $po = $_POST['po']; $requirements = $_POST['requirements']; /*products*/ $Product1 = $_POST['Product1']; $Product2 = $_POST['Product2']; /*TOTAL*/ $total = $Product1 + $Product2; /*Sending Email*/ $to = $_POST['to']; $subject = "Orders by $company"; $message = " FILE = $file Company = $company Ordered = $ordered Email = $email Date = $date PO = $po Requirements = $requirements PRODUCTS ---------------------------------------------- Product1 = $Product1 Product2 = $Product2 ----------------------------------------------------------- TOTAL PRODUCTS ORDERED = $total"; $headers = "From: $email\r\n"; $headers .= "Cc: $email\r\n"; if(mail($to, $subject, $message, $headers) echo "<table width='700' border='0' align='center' cellpadding='5' cellspacing='0'> <tr> <td>Thank you for submitting your online <strong>Orders</strong>. A copy of the order has been sent to your email address. Please check all details are correct.<br /> <br /> </td> </tr> <tr> <td><hr width='100%' size='1' noshade='noshade' /></td> </tr> </table>"; else echo "Mail send failure - message not sent"; ?> This is what the hosts told me to do: And this is how I amended the script: <?php $file = $_POST['file']; $SendEmail ="me@mydomain.com"; $company = $_POST['company']; $ordered = $_POST['ordered']; $email = $_POST['email']; $date = $_POST['date']; $po = $_POST['po']; $requirements = $_POST['requirements']; /*products*/ $Product1 = $_POST['Product1']; $Product2 = $_POST['Product2']; /*TOTAL*/ $total = $Product1 + $Product2; /*Sending Email*/ $to = $_POST['to']; $SendEmail ="me@mydomain.com"; $subject = "Orders by $company"; $message = " FILE = $file Company = $company Ordered = $ordered Email = $email Date = $date PO = $po Requirements = $requirements PRODUCTS ---------------------------------------------- Product1 = $Product1 Product2 = $Product2 ----------------------------------------------------------- TOTAL PRODUCTS ORDERED = $total"; $headers = "From: $email\r\n"; $headers .= "Cc: $email\r\n"; if(mail($to, $subject, $message, $headers, '-f'.$SendEmail)) echo "<table width='700' border='0' align='center' cellpadding='5' cellspacing='0'> <tr> <td>Thank you for submitting your online <strong>Orders</strong>. A copy of the order has been sent to your email address. Please check all details are correct.<br /> <br /> </td> </tr> <tr> <td><hr width='100%' size='1' noshade='noshade' /></td> </tr> </table>"; else echo "Mail send failure - message not sent"; ?> But still no result. I have now spent days trying variations on this, all without success. I get a confirmation page, but no emails are sent. Any suggestions would be much appreciated. Thank you