Avatar of webstudiointeractive

asked on 

PHP Mail not being recieved

Hi here,

I have set up a PHP mail function.  It is working when I set my address as the recipient, but when I change it to my client's address (which is a must) - the client never receives the email.

Please help!  My code is shown below.  I have noticed when I recieve the message, it says the following in the message headers:

Return-Path: <nobody@lion.host-care.com>
Received: from lion.host-care.com (lion.host-care.com [])

Even though I set the from address in the headers?  Could it be that my clients email account is blocking mail from lion.host-care.com ?  My mail service is run by Google and it recieves it fine?

Many thanks,

$to = "myemail@hiddenaddress.com";
$subject= "Action Request Form";
$todayis = date("l, F j, Y, g:i a") ;
$from = "HP Debt Solutions website <myemail@hiddenaddress.com>";
$message = "Client Company/Name: ".stripslashes($_POST['your_company'])."
\nClient Contact Person / Reference: ".stripslashes($_POST['your_contact'])."
\n\nDebtor Company Name / Name: ".stripslashes($_POST['debtor_name'])."
\nDebtor ABN: ".stripslashes($_POST['ABN'])."
\nDebtor Address: \n".stripslashes($_POST['Address'])."
\nDebtor Contact Person / Reference: ".stripslashes($_POST['debtor_contact'])."
\nDebtor Telephone No: ".stripslashes($_POST['Telephone'])."
\nDebtor Fax No: ".stripslashes($_POST['Fax'])."
\nIs Debtor Disputing Invoice: ".stripslashes($_POST['Dispute'])."
\n\nAny other Comments: \n\n".stripslashes($_POST['Comments']);
	      $headers = "From: " . $from . "\r\n" .
	      "MIME-Version: 1.0\r\n" .
	         "Content-Type: multipart/mixed;\r\n" .
	         " boundary=\"{$mime_boundary}\"";
	      $message = "This is a multi-part message in MIME format.\n\n" .
	         "--{$mime_boundary}\n" .
	         "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
	         "Content-Transfer-Encoding: 7bit\n\n" .
	      $message . "\n\n";
	      foreach($_FILES as $userfile)
	         $tmp_name = $userfile['tmp_name'];
	         $type = $userfile['type'];
	         $name = $userfile['firstname'];
	         $size = $userfile['size'];
	         if (file_exists($tmp_name))
	               $file = fopen($tmp_name,'rb');
	               $data = fread($file,filesize($tmp_name));
	               $data = chunk_split(base64_encode($data));
	            $message .= "--{$mime_boundary}\n" .
	               "Content-Type: {$type};\n" .
	               " name=\"{$name}\"\n" .
	               "Content-Disposition: attachment;\n" .
	               " filename=\"{$fileatt_name}\"\n" .
	               "Content-Transfer-Encoding: base64\n\n" .
	            $data . "\n\n";
if (mail($to, $subject, $message, $headers))
<script language="javascript" type="text/javascript">
	alert("Your Action Request Form has been sent successfully!");
	document.location = "send-us-your-debtor.html";
<script language="javascript" type="text/javascript">
	alert("Your Form has not been sent due to an error. Please try again.");
	document.location = "send-us-your-debtor.html";

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon