-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact_script.php
42 lines (27 loc) · 1.3 KB
/
contact_script.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
<?php
if(isset($_POST['myData'])){
$myData = json_decode($_POST['myData']);
iconv_set_encoding("internal_encoding", "UTF-8");
$name = $myData->name;
$from = $myData->email;
$message_txt = $myData->message;
$mail = 'paul.antoine2@gmail.com';
$passage_ligne = "\n";
$boundary = "-----=".md5(rand());
$boundary_alt = "-----=".md5(rand());
$sujet = 'Contact Portfolio';
$header = 'From: '.$name.' <'.$from.'>'.$passage_ligne;
$header.= 'Reply-to: '.$from.' <'.$from.'>'.$passage_ligne;
$header.= 'MIME-Version: 1.0'.$passage_ligne;
$header.= 'Content-Type: multipart/mixed;'.$passage_ligne.' boundary="'.$boundary.'"'.$passage_ligne;
$message = $passage_ligne.'--'.$boundary.$passage_ligne;
$message.= 'Content-Type: multipart/alternative;'.$passage_ligne.' boundary="'.$boundary_alt.'"'.$passage_ligne;
$message.= $passage_ligne."--".$boundary_alt.$passage_ligne;
$message.= 'Content-Type: text/plain; charset="UTF-8\"'.$passage_ligne;
$message.= "Content-Transfer-Encoding: 8bit".$passage_ligne;
$message.= $passage_ligne.$message_txt.$passage_ligne;
$message.= $passage_ligne."--".$boundary_alt.$passage_ligne;
$res = mail(utf8_decode($mail),utf8_decode($sujet),utf8_decode($message_txt),utf8_decode($header));
echo $res;
}
?>