I wanted to send an email such as an confirmation email to an email address that the user has alredy specified in an input tag. Exampe: I type in my email in an input tag and then I would recive an email at the address I entered in the input tag. Thanks, and If you know the answer could you possibly send me an code to paste in. (Im an php noob)
Asked
Active
Viewed 45 times
-2
-
1You should also know that stackoverflow is not meant to provide you codes for your projects but to help you when you tried and can't solve a coding problem. A simple google search would have given you an anwer or SO would have given you an answer while typing in your question – Oke Tega Mar 04 '17 at 20:10
1 Answers
-1
<?php
$recipient = $_POST['email']; //recipient
$email = "your@domain.com"; //senders e-mail adress
if((filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest == "")) {
$Name = ($_POST['name']); //senders name
$mail_body = !!!----> WHAT DO I PUT HERE <----!!!!
$subject = "Porter Inquiry"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header); //mail command :)
} else {
print "You've entered an invalid email address!";
}
?>

Resheil Agarwal
- 155
- 1
- 11
-
-
there is a change in this part of code that is the $recipient and $email. – Resheil Agarwal Mar 04 '17 at 20:16
-
Code dumps to not make for good answers. You should explain how and why this solves their problem. You should read, "[How do I write a good answer?"](http://stackoverflow.com/help/how-to-answer) – John Conde Mar 04 '17 at 22:38
-
Please don't post answers on obviously off-topic questions! [See: **Should one advise on off topic questions?**](http://meta.stackoverflow.com/q/276572/1768232) Off-topic questions can be closed and deleted, which could nullify your contribution. – John Conde Mar 04 '17 at 22:39