0
<?php if (isset ($_POST['submit'])&& ($_POST['submit']!='')){
      $to = 'manojpraharsha@gmail.com';
      $subject = 'Website Enquery Request';
      $email = $_POST['email'];
      $name = $_POST['name'];
      $headers = 'From: Timespaces <'.$to.'>' . "\r\n";
      $headers .= 'Reply-To: '.$name.' <'.$email.'> ' . "\r\n";
      $headers .= 'Return-Path:' .$to . "\r\n";
      $headers .= 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-Type: text/html; charset=ISO-8859-1' . "\r\n";
      $message .= '<html><body>';
      $message .= '<table rules="all" style="border-color:rgb(130,0,67);" cellpadding="10">';
      $message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . strip_tags($_POST['name']) . "</td></tr>";
      $message .= "<tr><td><strong>Email:</strong> </td><td>" . $email . "</td></tr>";
      $message .= "<tr><td><strong>Phone:</strong> </td><td>" . strip_tags($_POST['phone']) . "</td></tr>";
      $message .= "<tr><td><strong>Subject:</strong> </td><td>" . strip_tags($_POST['subject']) . "</td></tr>";
      $message .= "</table>";
      $message .= "</body></html>";
      mail($to, $subject, $message, $headers);
      }
      ?>

is there any mistakes in here where i tried all possibilities but also all mails goes to my spam

manoj
  • 297
  • 2
  • 11
  • Possible duplicate of [PHP mail() form sending to GMAIL spam](https://stackoverflow.com/questions/12188334/php-mail-form-sending-to-gmail-spam) – Ankur Tiwari Nov 13 '17 at 07:29
  • I used same code also, but same problem – manoj Nov 13 '17 at 07:32
  • This topic has been discussed on SO many times in many different ways. Please continue to research and tell us all of the ways that you have tried to solve and which links your have found. – mickmackusa Nov 13 '17 at 07:32
  • yea i have research all the codes and i have tried all of them including the code in the link you have suggested , but same issue its going to spam only – manoj Nov 13 '17 at 08:03
  • The error message in gmail is 'This message may not have been sent by: $email' $email is the details entired by user – manoj Nov 13 '17 at 08:40
  • you're forging the sender, probably failing DKIM and SPF too. – Jasen Nov 13 '17 at 09:06
  • also using "return path" in an email header – Jasen Nov 13 '17 at 09:11
  • If you really have "researched all the codes" and "tried all possibilities", then clearly there is nothing new we can tell you. Please [edit] the question to include as much detail as you can. *What* have you researched? *What* possibilities have you tried? What is the *exact* result you've seen in GMail? Right now, there's a high chance of us telling you things you've already tried, because we're just playing guessing games, which is a waste of everyone's time. – IMSoP Nov 13 '17 at 10:53

1 Answers1

1

You can use PHP Mailer with SMTP authentication, or send using dedicated IP with popular( in active conversation ) sender email ID

helpdoc
  • 1,910
  • 14
  • 36