hello
Je dois envoyer automatiquement un mail + piece jointe (pdf) après remplissage d'un formulaire.
Tout se passe pour le mieux, le mail et le fichier sont envoyés, mais impossiblbe d'ouvrir le fichier (poids de 95o au lieu de 1,5Mo)
Je pense donc modifier la restriction au niveau du poids si il y en a une, mais je ne vois pas ou le faire ...
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 $to = 'info@kikoolol.fr'; $subject = '/// KIKOOLOL ///'; $boundary = md5(uniqid(microtime(), TRUE)); $headers = 'From: kikoolol <info@kikoolol.fr>'."\r\n"; $headers .= 'Mime-Version: 1.0'."\r\n"; $headers .= 'Content-Type: multipart/mixed;boundary='.$boundary."\r\n"; $headers .= "\r\n"; $msg = 'This is a multipart/mixed message.'."\r\n\r\n"; $msg .= '--'.$boundary."\r\n"; $msg .= 'Content-type:text/plain;charset=utf-8'."\r\n"; $msg .= 'Content-transfer-encoding:8bit'."\r\n"; $msg .= "Rappel des données \r\n"; $msg .= "\r\n"; $msg .= "SOCIETE : $soc \r\n"; $msg .= "ACTIVITE : $act \r\n"; $msg .= "CODE APE : $ape \r\n"; $msg .= "NUMERO SIREN : $si \r\n"; $msg .= "ADRESSE : $adr \r\n"; $msg .= "CODE POSTAL : $cp \r\n"; $msg .= "VILLE : $vil \r\n"; $msg .= "NOM : $no \r\n"; $msg .= "PRENOM : $pr \r\n"; $msg .= "TELEPHONE : $tel \r\n"; $msg .= "FAX : $fa \r\n"; $msg .= "SITE INTERNET : $url \r\n"; $msg .= "EMAIL : $em \r\n "; $msg .= "\r\n"; $file_name = 'TARIF.pdf'; if (file_exists($file_name)) { $file_type = filetype($file_name); $file_size = filesize($file_name); $handle = fopen($file_name, 'r') or die('File '.$file_name.'can t be open'); $content = fread($handle, $file_size); $content = chunk_split(base64_encode($content)); $f = fclose($handle); $msg .= '--'.$boundary."\r\n"; $msg .= 'Content-type:'.$file_type.';name='.$file_name."\r\n"; $msg .= 'Content-transfer-encoding:base64'."\r\n"; $msg .= $content."\r\n"; } $msg .= '--'.$boundary."\r\n"; mail($to, $subject, $msg, $headers);









Répondre avec citation
Partager