-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnewslettre.php
62 lines (49 loc) · 2.1 KB
/
newslettre.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
if(isset($_POST['abonner']))
{
$email = htmlspecialchars(stripslashes(trim($_POST['email']))); // Get Email Value
if(!preg_match("/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/", $email)){
$email_error = 'Invalid email';
}
$to = "[email protected]"; // You can change here your Email
$subject = "You have a email subscriber from kolna Explorer website"; // This is your subject
// HTML Message Starts here
$message ="
<html>
<body>
<h2 style='text-align:center'>kolna Explorer</h2>
<table style='width:40%; margin:auto; font-size:3vw' border='1'>
<tr style='text-align:center'>
<th></th>
<th>subscribers</th>
</tr>
<tr style='text-align:center'>
<td><b>Email</b></td>
<td>$email</td>
</tr>
</table>
</body>
</html>
";
// HTML Message Ends here
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: Admin <[email protected]>' . "\r\n"; // Give an email id on which you want get a reply. User will get a mail from this email id
// $headers .= 'Cc: [email protected]' . "\r\n"; // If you want add cc
// $headers .= 'Bcc: [email protected]' . "\r\n"; // If you want add Bcc
if(mail($to,$subject,$message,$headers)&& !isset($email_error)){
// Message if mail has been sent
echo "<script>
alert('Mail has been sent Successfully.');
</script>";
}
else{
// Message if mail has been not sent
echo "<script>
alert('Email failed to sent');
</script>";
}
}
?>