PHP - Script Simple - Unexpected $end
The_QcR
-
The_QcR -
The_QcR -
Bonjour,
J'ai encore un petit problème en php :P !!
J'aurais besoin d'aide pour ce script qui me permet d'envoyer des pièces jointes par email (Mais des mails en HTML)
Voici l'erreur : Parse error: syntax error, unexpected $end in /home/commint/public_html/admin/envoyer_doc_a.php on line 64
Voici mon code ! Merci de votre aide !!
<?php
// Setting a timezone, mail() uses this.
// recipients
$email = $_POST['email'];
$file = $_POST['file'];
$motifmail = $_POST['motif'];
$attachment = file_get_contents("/home/commint/public_html/dl/$file");
$HTML = "<img src='http://comm-inter-tel.ca/img/logo.jpg'></img><center><br><font face='Century Gothic' size='5'>Lien de téléchargement</font><font face='Century Gothic'><center><br>$motifmail<br><a href='http://comm-inter-tel.ca/download.php?$cdname' target='_blank'>http://comm-inter-tel.ca/download.php?$cdname</a></font>";
$from = "info@comm-inter-tel.com";
$to = $email;
$subject = "Inter-Tel.ca - Lien de téléchargement";
sendHTMLemail($HTML,$from,$to,$subject);
function sendHTMLemail($HTML,$from,$to,$subject)
{
// First we have to build our email headers
// Set out "from" address
$headers = "From: $from\r\n";
// Now we specify our MIME version
$headers .= "MIME-Version: 1.0\r\n";
// Create a boundary so we know where to look for
// the start of the data
$boundary = uniqid("HTMLEMAIL");
// First we be nice and send a non-html version of our email
$headers .= "Content-Type: multipart/alternative;".
"boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$headers .= "--$boundary\r\n".
"Content-Type: text/plain; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode(strip_tags($HTML)));
// Now we attach the HTML version
$headers .= "--$boundary\r\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= "Content-Type: application/octet-stream; name=$file".
"Content-Transfer-Encoding: base64\r\n\r\n".
"Content-Disposition: attachment";
$headers .= chunk_split(base64_encode($HTML));
?>
J'ai encore un petit problème en php :P !!
J'aurais besoin d'aide pour ce script qui me permet d'envoyer des pièces jointes par email (Mais des mails en HTML)
Voici l'erreur : Parse error: syntax error, unexpected $end in /home/commint/public_html/admin/envoyer_doc_a.php on line 64
Voici mon code ! Merci de votre aide !!
<?php
// Setting a timezone, mail() uses this.
// recipients
$email = $_POST['email'];
$file = $_POST['file'];
$motifmail = $_POST['motif'];
$attachment = file_get_contents("/home/commint/public_html/dl/$file");
$HTML = "<img src='http://comm-inter-tel.ca/img/logo.jpg'></img><center><br><font face='Century Gothic' size='5'>Lien de téléchargement</font><font face='Century Gothic'><center><br>$motifmail<br><a href='http://comm-inter-tel.ca/download.php?$cdname' target='_blank'>http://comm-inter-tel.ca/download.php?$cdname</a></font>";
$from = "info@comm-inter-tel.com";
$to = $email;
$subject = "Inter-Tel.ca - Lien de téléchargement";
sendHTMLemail($HTML,$from,$to,$subject);
function sendHTMLemail($HTML,$from,$to,$subject)
{
// First we have to build our email headers
// Set out "from" address
$headers = "From: $from\r\n";
// Now we specify our MIME version
$headers .= "MIME-Version: 1.0\r\n";
// Create a boundary so we know where to look for
// the start of the data
$boundary = uniqid("HTMLEMAIL");
// First we be nice and send a non-html version of our email
$headers .= "Content-Type: multipart/alternative;".
"boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$headers .= "--$boundary\r\n".
"Content-Type: text/plain; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode(strip_tags($HTML)));
// Now we attach the HTML version
$headers .= "--$boundary\r\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= "Content-Type: application/octet-stream; name=$file".
"Content-Transfer-Encoding: base64\r\n\r\n".
"Content-Disposition: attachment";
$headers .= chunk_split(base64_encode($HTML));
?>
A voir également:
- PHP - Script Simple - Unexpected $end
- Iphone 14 simple - Guide
- Script vidéo youtube - Guide
- Simple pdf - Télécharger - PDF
- Mas script - Accueil - Windows
- Easy php - Télécharger - Divers Web & Internet
12 réponses
MERCI JEANGILLES !!
tu es génial ! :P
quand on ouvre une fonction on doit la fermer en ;)
Mais je comprend pas car je reçois pas le mail :O
tu es génial ! :P
quand on ouvre une fonction on doit la fermer en ;)
Mais je comprend pas car je reçois pas le mail :O
ben moi ca métonne pas vraiment ^^
ajoutes à la fin de la fonction
mail ($to, $subject ,
$HTML, $headers);
ajoutes à la fin de la fonction
mail ($to, $subject ,
$HTML, $headers);
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Ya toutde même un problème !! Je reçois un e-mail mais ya rien dedans et sa m'indique qu'il y une pièce jointe mais il y en pas !!
Ben la piece jointe cest parce que tas mis
$headers .= "Content-Type: application/octet-stream; name=$file".
"Content-Transfer-Encoding: base64\r\n\r\n".
"Content-Disposition: attachment";
et pour le contenu, javais pensé que cétait la variable $HTML qui était passé en parametre, si cest pas ca faut faire un truc dans ce genre là ^^
$headers .= "Content-Type: application/octet-stream; name=$file".
"Content-Transfer-Encoding: base64\r\n\r\n".
"Content-Disposition: attachment";
et pour le contenu, javais pensé que cétait la variable $HTML qui était passé en parametre, si cest pas ca faut faire un truc dans ce genre là ^^
Mmmm.... Mais j'ai trouver qqch de fonctionnel sur le web qui fonctionne beaucoup mieux mais la ligne :
Content-Type: application/octet-stream; name=$file
fait que le fichier que je reçois est $file ... mais je voudrais plutôt recevoir la valeur de $file ! Car le fichier change à chaque envoi !
Content-Type: application/octet-stream; name=$file
fait que le fichier que je reçois est $file ... mais je voudrais plutôt recevoir la valeur de $file ! Car le fichier change à chaque envoi !
ben si tu mets 'Content-Type: application/octet-stream; name=$file', c'est sur que cest la chaine de caractères $file qui sera envoyés
par contre si tu mets "Content-Type: application/octet-stream; name=$file " (avec des " à la place des ') là c'est ta variable $file sera interprétée comme une variable justement
par contre si tu mets "Content-Type: application/octet-stream; name=$file " (avec des " à la place des ') là c'est ta variable $file sera interprétée comme une variable justement
Ouais, ça je savais mais regarde, il n'y a pas de guillemets nulle part alors je sais pas trop !
Regarde cette portion du code
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/octet-stream; name=$file
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
j'ai même essayer de mettre \"$file\" mais sa ne fonctionne pas plus !!
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/octet-stream; name=\"$file\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
Regarde cette portion du code
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/octet-stream; name=$file
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
j'ai même essayer de mettre \"$file\" mais sa ne fonctionne pas plus !!
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/octet-stream; name=\"$file\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--