Hello again, so this week I will make an auto-sender, what is an auto-sender? well the auto-sender that I will build is for php form, but can be applied in a big range of thing like to send periodic newsletters and others.
I will explain step-by-step but I recommend having the basics of PHP.
Let's start;
so lets build the form:
This should look like tis form:
Name:
E-mail:
Comments:
so with the basic for created, now he will create a new php file where we will send the form to an e-mail and the auto-sender that will send an e-mail to the e-mail placed on the form.
so we start by open the php code:
and now we will create the variables for the e-mail form, to create a variable we wright: $variable_name, variables cannot have any spaces so we place an underscocre.
$to = "youremail@youremail.com";
$subject = "create an auto-sender";
$email = $_REQUEST['e-mail'];
$name= $_REQUEST['name'];
$mensage= $_REQUEST['comments'];
$headers = "From: $email";
$sent = mail($to, $subject, $mensage, $headers) ;
if($sent)
{print "Thanks for contacting me, I will be in touch soon."; }
else
{print "We encountered an error sending your request,please try again, if the problem continue contant me on youremail@youremail.com"; }
?>
Now that we have created the email php script we will start to create the auto-sender, that is no more no less tham a secound php email script.
$responseSubject = "$name, your email have been recived";
$responseMessage = "Hello $name,\n\nThanks for submitting your email.
I will be in contact with you shortly to resolve your query.";
$responseFromName = "--your name--";
$responseFromEmail = "youremail@youremail.com";
mail($email, $responseSubject, $responseMessage,
"From: ".$responseFromName." <".$responseFromEmail.">");
?>
And its all, we have now a php email form with an auto-sender
No comments:
Post a Comment