PHP Email piece

  • DJ Overpour
  • Newbie
  • Newbie
  • DJ Overpour
  • Posts: 11

Post 3+ Months Ago

I have a website http://www.bobbykeys.com that I am trying to create a php email script for. I have done this in the past where I setup a form and then reference the fields in my script (sendto, subject, headers, etc..).

The problem I am having is that I have a component on the page that asks if you want to sign up for a club newsletter. The only field is the email address. I want to create a script that when the guest enters his or her email address in the box it would trigger and email to be sent to my desired location.

As I said I have done this before where I have multiple fields and I have the info called upon from the php script. The part where I am confused is that alot of the data is static. The subject, sendto and message fields of the email wouldnt change, all i need is the address thats inserted into the field to be called upon in the reply to section of the script. Make sense? lol.

I have tried multiple ways of setting "static" data in the script but I cant get it figured out. All help would be apprecited.

Here is the code I am working with:

Code: [ Select ]
$sendTo = "info@bobbykeys.COM";
$subject = "WEB SITE INFO REPLY";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"];

$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);
?>
  1. $sendTo = "info@bobbykeys.COM";
  2. $subject = "WEB SITE INFO REPLY";
  3. $headers = "From: " . $_POST["name"];
  4. $headers .= "<" . $_POST["email"] .">\r\n";
  5. $headers .= "Reply-To: " . $_POST["email"];
  6. $message = $_POST["message"];
  7. mail($sendTo, $subject, $message, $headers);
  8. ?>


Thanks again.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

sorry i am unable to understand what u want to say.Can u tell me exactly what u r facing????
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

Perhaps try something like:

Code: [ Select ]

$message = "message";
$email = $_POST['email']; 

mail("$email","Message subject here..",$message,"From: Your real name <you@yourwebsite.com>\nX-Mailer: PHP/" . phpversion());
  1. $message = "message";
  2. $email = $_POST['email']; 
  3. mail("$email","Message subject here..",$message,"From: Your real name <you@yourwebsite.com>\nX-Mailer: PHP/" . phpversion());
  • DJ Overpour
  • Newbie
  • Newbie
  • DJ Overpour
  • Posts: 11

Post 3+ Months Ago

Thanks for the reply I will try that. What I am trying to say is that I want to just have php send an email to me with just the email address of the sender. The other fields (subject, name, etc) just need to be blank or predifined. It sounds like its possible since I can create a php script that would send me an email with a subject and header and reply to, but I just need the email address of the sender basically. I have absolutley no knowledge of php so I hope someone can help. Thanks
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

I'm not certain I understand exactly what you are trying to do but I suggest some things which hopefully will help

If you have a form on yout web site where the visitor enters their email address in a text field named "email", you can send the visitos email address to your self by using:

Code: [ Select ]
$message = "\n email address: $email";


In the example above, assuming the email address entered was "joe@smith.com", the message that would be sent would be:

email address: joe@smith.com

And yes you can hardcode values into the php mail() function for sender, subject, recipent, etc...
  • DJ Overpour
  • Newbie
  • Newbie
  • DJ Overpour
  • Posts: 11

Post 3+ Months Ago

thanks a ton harryhood. The only question I have left is what syntax would I use to hardcode the info into the script. Im not sure exactly what to type. Thanks again
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

I don't think I can explain it any better than this -> http://www.php.net/manual/en/function.mail.php

Let me know if you need anything else at all.
  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

$sendTo = "info@bobbykeys.COM";
$subject = "WEB SITE INFO REPLY";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"];

$message = $_POST["email"];

mail($sendTo, $subject, $message, $headers);
?>


try this out i think u will get it...
  • DJ Overpour
  • Newbie
  • Newbie
  • DJ Overpour
  • Posts: 11

Post 3+ Months Ago

works perfectly. thanks guys

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 89 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.