-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecure_email_code.php
39 lines (37 loc) · 1.29 KB
/
secure_email_code.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
//not cache this page
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if(isset($_POST["send"])){
// Checking For Blank Fields..
if($_POST["headline"]==""||$_POST["email"]==""||$_POST["story"]==""){
$var2='Fill All Fields..';
}else{
// Check if the "Sender's Email" input field is filled out
$email=$_POST['email'];
// Sanitize E-mail Address
$email =filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate E-mail Address
$email= filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email){
$var2= "Invalid Sender's Email";
}
else{
$subject = "Lean In story";
$story = "Email ID : ".$email."\nHeadline : ".$_POST['headline']."\n".$_POST['story'];
$headers = 'From:'. $email . "\r\n"; // Sender's Email
//$headers .= 'Cc:'. $email . "\r\n"; // Carbon copy to Sender
// Message lines should not exceed 70 characters (PHP rule), so wrap it
//$message = wordwrap($message, 70);
// Send Mail By PHP Mail Function
mail("[email protected]", $subject, $story, $headers);
$var2='yes';
echo "Your story has been submitted successfully ! Our editors will get back to you, if your story gets selected! Thank you. ";
}
}
}
//redirect to this location. URL needs to be fixed
header("Location: index.php");
die();
?>