Page 1 sur 1

[Résolu]Problème export mail en eml (GMAIL)

MessagePublié: 25 Juil 2013 à 09:20
par mike76
Bonjour,

J'utilise ce code pour l'export de mail au format eml

http://searchdomino.techtarget.com/tip/Exporting-email-from-Lotus-Notes-to-EML-messages

Le code fonctionne très bien avec tous les FAI, sauf lorsque je reçois un mail de GMAIL.
Lorsque j'exporte mon mail en eml avec ce code, j'obtiens ce résultat avec l'ouverture du mail en eml dans Outlook.
Mon mail à l'origine ne contient que la lettre e.

Avec GMAIL apparaît "Content-Type: text/plain; charset=ISO-8859-1"
et "Content-Type: text/html; charset=ISO-8859-1<div dir="ltr">e</div>"

Content-Type: text/plain; charset=ISO-8859-1


e


Content-Type: text/html; charset=ISO-8859-1


<div dir="ltr">e</div>


Auriez-vous une idée comment je peux corriger le code pour que ça fonctionne également avec GMAIL ??

Merci d'avance pour votre aide.

Re: Problème export mail en eml (GMAIL)

MessagePublié: 25 Juil 2013 à 14:58
par mike76
J'ai trouvé ce lien :
http://tech.niques.info/projects/lotus- ... il-export/

I noticed that in Noted 8.5.1, some multipart/mixed messages that originated via SMTP did not work right — when I opened the eml file, it just showed as the mime text, not the attachments. (perhaps this was the same issue Ketch’s saw with 8.5)

Problem was that the agent was looking for quotes after boundary=, but RFC-2046 does not require quotes.

I added the following lines to GetBoundary to fix this issue. These are added in after the first boundary = strright(header,”boundary=”"”) call, to check and correct for the condition when no quotes are there.

In the case I saw, the boundary ends with a CRLF. I think technically one should remove whitespace to be more robust –it is legal to have whitespace between the boundary and the CRLF, but that is not part of the boundary string itself — though I did not do that here:

If (Len(boundary)=0) then
boundary = strright(header,”boundary=”,1)
boundary = strleft(boundary,chr(13))
end if


Je rencontre le même problème que ce gars mais en corrigeant le code comme il l'indique, j'ai toujours le même problème :(

Re: Problème export mail en eml (GMAIL)

MessagePublié: 25 Juil 2013 à 16:33
par mike76
Je suis en version 8.5.3
J'ai testé la nouvelle fonctionnalité "Engistrer sous fichier EML" avec mon mail GMAIL

Si je je compare les 2 fichiers, celui généré par l'agent lotusscript et l'autre par Lotus
La fin des fichiers sont différentes.

Voici la fin du fichier généré par l'agent :
Content-Type: text/plain; charset=ISO-8859-1


THE BODY MAIL


Content-Type: text/html; charset=ISO-8859-1


<div dir="ltr">THE BODY MAIL</div>



Voici la fin du fichier générée par la fonctionnalité Lotus :
--047d7bdc93ca17a41704e256c6e8
Content-Type: text/plain; charset=ISO-8859-1

THE BODY MAIL

--047d7bdc93ca17a41704e256c6e8
Content-Type: text/html; charset=ISO-8859-1

<div dir="ltr">THE BODY MAIL</div>

--047d7bdc93ca17a41704e256c6e8--


Si j'ajoute 047d7bdc93ca17a41704e256c6e8 dans mon fichier généré par l'agent, aux mêmes endroits que le fichier généré par Lotus, et bien mon mail (format eml) s'ouvre correctement dans Outlook.

Pourquoi manque-t-il cette série de caractères dans le fichier généré par l'agent, elle correspond au "boundary" ??

Re: Problème export mail en eml (GMAIL)

MessagePublié: 25 Juil 2013 à 17:06
par mike76
C'est bon j'ai trouvé.

Voici la solution si cela vous intéresse :

J'ai ajouté au code ce bloc :
Code : Tout sélectionner
   If Len(boundary)=0 Then
      boundary = StrRight(header,{boundary=})
   End If



Code : Tout sélectionner
Function GetBoundary (header As String) As String
   Dim boundary As String
   
   On Error GoTo erreur
   
   boundary=StrRight(header, "boundary=""")
   
   If Len(boundary)=0 Then
      boundary = StrRight(header,”boundary=”,1)
      boundary = StrLeft(boundary,Chr(13))
   End If

   If Len(boundary)=0 Then
      boundary = StrRight(header,{boundary=})
   End If   
   
   If (InStr(boundary, """") > 0) Then
      boundary=StrLeft(boundary, """")
   End If
   
   If (Len(boundary) > 0) Then
      boundary="--" & boundary
   End If
   
   GetBoundary=boundary
   
   Exit Function
   
erreur:
   MsgBox "Erreur (GetBoundary) : " & Error & " - ligne n° : " & erl
   End
   
End Function