Jump to content

[SOLVED] Automating a reply to mail.


matt.sisto

Recommended Posts

Hello, I am trying to get my mail script to send reply to the mail sender when the message is sent.

 

messageTechnical.php

<?php

require "dbconn2.php";

  $from = $_POST['email'];
  $sender = $_POST['name'];
  $message = $_POST['content'];

  $to = '[email protected]';
  $headers = "SRC Message From: $from";
  $footers = "Salmons Reach Consultancy. Striving to achieve excellence.";

if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $from)){
  header("Location: error.php");
  exit();
}

if (preg_match("/http:\/\//i", $from)){
  header("Location: error.php");
  exit();
}
if (preg_match("/http:\/\//i", $sender)){
  header("Location: error.php");
  exit();
}
if(preg_match("/http:\/\//i", $message)){
  header("Location: error.php");
  exit();
}

mail($to, $sender, $message, $headers);
header("Location: replyTechnical.php");
  exit();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>?Message Technical Support</title>
</head>
<body>
</body>

 

replyTechnical.php:

<?php

require "dbconn2.php";
  
  $to = $_POST['email'];
  $sender = '[email protected]';
  $headers = "SRC: Technical Support";
  $message = "We value your patience, and will try to get back to you asap. Thanks and Regards, SRC Technical Support Team";

mail($to, $sender, $message, $headers);
header("Location: technical.php");
  exit();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Technical Reply</title>
</head>
<body>
</body>

 

I have echoed out the value of the variables and there is an issue with passing the email value. Any help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/152068-solved-automating-a-reply-to-mail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.