Piece jointe qui arrive corrompue
Résolu
Mourad2024
Messages postés
2
Date d'inscription
samedi 15 juin 2024
Statut
Membre
Dernière intervention
28 juin 2024
-
Modifié le 27 juin 2024 à 21:53
[Dal] Messages postés 6193 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 4 juillet 2024 - 4 juil. 2024 à 09:45
[Dal] Messages postés 6193 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 4 juillet 2024 - 4 juil. 2024 à 09:45
A voir également:
- Piece jointe qui arrive corrompue
- 1 pièce jointe - Guide
- Publipostage outlook avec pièce jointe pdf ✓ - Forum Word
- One piece kai ✓ - Forum Cinéma / Télé
- Pps piece jointe - Forum Réseaux sociaux
- Ouvrir une pièce jointe pps - Forum Mail
3 réponses
[Dal]
Messages postés
6193
Date d'inscription
mercredi 15 septembre 2004
Statut
Contributeur
Dernière intervention
4 juillet 2024
1 090
28 juin 2024 à 11:09
28 juin 2024 à 11:09
Salut Mourad2024,
Je n'ai jamais fait cela avec libcurl, mais je pense que tu dois encoder ton fichier .pdf en base64 car tu ne peux pas envoyer le contenu binaire du .pdf par e-mail, ce n'est simplement pas supporté par les protocoles.
Essaye d'encoder ta partie mime contenant le .pdf avec curl_mime_encoder() en spécifiant le format d'encodage "base64" :
Mourad2024
Messages postés
2
Date d'inscription
samedi 15 juin 2024
Statut
Membre
Dernière intervention
28 juin 2024
28 juin 2024 à 18:21
28 juin 2024 à 18:21
Bonjour Dal,
Merci beaucoup de prendre le temps de me répondre, et surtout merci pour tes conseils et tes observations, je fais les modifs et je tiendrai au courant.
Mourad2009B
Messages postés
104
Date d'inscription
lundi 23 août 2010
Statut
Membre
Dernière intervention
2 juillet 2024
2 juil. 2024 à 18:53
2 juil. 2024 à 18:53
C'était très efficace DAL, merci beaucoup pour ton aide.
[Dal]
Messages postés
6193
Date d'inscription
mercredi 15 septembre 2004
Statut
Contributeur
Dernière intervention
4 juillet 2024
1 090
4 juil. 2024 à 09:45
4 juil. 2024 à 09:45
Super, merci de ton retour :-)
Modifié le 28 juin 2024 à 13:02
Autre observation : tu peux aussi utiliser curl_mime_filedata() pour mettre ton fichier .pdf dans ta partie mime
https://curl.se/libcurl/c/curl_mime_filedata.html
Cela t'évitera de lire ton fichier avec readFile() dans une std::string C++ en amont et remplacera curl_mime_data() et curl_mime_filename() (le nom du fichier est apposé en même temps).
Aussi, n'oublie pas que les différentes fonctions de libcurl retournent des valeurs qui te permettent de vérifier que tout s'est bien passé.
Un code robuste vérifie ces valeurs et agit en conséquence.