0

This is my code and i have done everything to make it work but i am stuck. I can't get this code to sent email out ..

<?php
if(isset($_REQUEST['submit']))
{
$to  =  "[email protected]";
$subject = "Find Dealer @ flowsleeve";
$headers = "From: Find Dealer ";
$headers .= "Reply-To: ". strip_tags("[email protected]") . "\r\n";
$headers  = 'MIME-Version: 1.0' . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$messsage = "
 Name             : ".$_REQUEST['first_name']."
Email            : ".$_REQUEST['email']."
Event Type       : ".$_REQUEST['event_type']."
Event location   : ".$_REQUEST['event_location']."
Last Name        : ".$_REQUEST['last_name']."
Home Phone       : ".$_REQUEST['home_phone']."
Event Date       : ".$_REQUEST['event_date']."
Referrer         : ".$_REQUEST['referrer']."
Message          : ".$_REQUEST['message']."";

mail($to,$subject,$message,$headers);
7
  • 1
    what do you mean by it 'doesn't work'? Commented Sep 29, 2015 at 11:19
  • What's the error 5 bit from? Commented Sep 29, 2015 at 11:20
  • Try echoing the last function to check whether it returns true or false. Besides this, add . in line 8 Commented Sep 29, 2015 at 11:22
  • @cylua2 i put this code on a server and when i submit nothing happen .... Commented Sep 29, 2015 at 11:27
  • @jon Stirling i have no idea what that mean i am using this site for the first time ... Commented Sep 29, 2015 at 11:28

2 Answers 2

1

The problem is in header section. You forgot to add . in line 8. Take a look at this and correct it.

      $headers = "From: Find Dealer ";
      $headers .= "Reply-To: ". strip_tags("[email protected]") . "\r\n";
      $headers .= 'MIME-Version: 1.0' . PHP_EOL;
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

Because of this mistake, header will contain only mime version info, content type and charset.

Sign up to request clarification or add additional context in comments.

Comments

1

I tried your code, without the if ( isset .. statement. Your code works successfully. Please add additional code or errors.

Make sure you also check your spamfolder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.