Smtp

View: New views
7 Messages — Rating Filter:   Alert me  

Smtp

by jacky-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bonjour,

c'est encore moi :)

deux petites questions concernant smtp.
1- lorsque j'envoie un fichier png ou ps, il est altéré à l'arrivée
(taille ridicule) et est illisible
2- lorsque j'envoie une piece jointe, le corps du message n'est pas envoyé.

Quelqu'un a-t-il une idée ?

Voici la routine d'envoi.


PUBLIC SUB Envoi(Email AS String, sujet AS String, Txt AS String, piece
AS Boolean, chemin AS String, TypeM AS String, FileN AS String)
   DIM Hmail AS NEW SmtpClient
   WITH Hmail
   IF NOT IsNull(EMail) THEN
     .Host = Settings["/Smtp"]
     .From = Settings["/Adrmail"]
     .Subject = sujet
     .Alternative = FALSE
     IF Piece = TRUE THEN .Alternative = TRUE
     .To.Add(Email)
     IF piece = TRUE THEN
       .Add(chemin, TypeM, FileN)
     ENDIF
     .Add(Txt, "text/plain;charset=utf-8")
     TRY .Send()
     IF ERROR THEN Message.Error("Veuillez vérifier la configuration de
vos coordonnées mail dans les préférences SVP !")
   ENDIF
   END WITH
END

Voici la routine qui me sert à déterminer le type mime des pieces jointes.

PUBLIC FUNCTION Extension(FileN AS String) AS String

DIM Ext AS String[]
DIM Type AS String
Ext = Split(FileN, ".")
' types text
IF LCase$(Ext[1]) = "html" OR IF LCase$(Ext[1]) = "css" OR IF
LCase$(Ext[1]) = "xml" OR IF LCase$(Ext[1]) = "xsl"
   Type = "text/" & Ext[1]
ENDIF
IF LCase$(Ext[1]) = "txt" OR IF LCase$(Ext[1]) = "csv"
   Type = "text/plain"
ENDIF
' types images
IF LCase$(Ext[1]) = "gif" OR IF LCase$(Ext[1]) = "png" OR IF
LCase$(Ext[1]) = "tiff" OR IF LCase$(Ext[1]) = "bmp"
   Type = "image/" & Ext[1]
ENDIF
IF LCase$(Ext[1]) = "jpg" OR IF LCase$(Ext[1]) = "jpeg"
   Type = "image/jpeg"
ENDIF
'types video
IF LCase$(Ext[1]) = "mpeg" OR IF LCase$(Ext[1]) = "mpg" OR IF
LCase$(Ext[1]) = "avi" OR IF LCase$(Ext[1]) = "wav"
   Type = "video/" & Ext[1]
ENDIF
'type audio
IF LCase$(Ext[1]) = "mp3"
   Type = "audio/mpeg"
ENDIF
IF LCase$(Ext[1]) = "wma"
   Type = "audio/x-ms-wma"
ENDIF
'types application
IF LCase$(Ext[1]) = "ogg" OR IF LCase$(Ext[1]) = "pdf" OR IF
LCase$(Ext[1]) = "rtf" OR IF LCase$(Ext[1]) = "zip"
   Type = "application/" & Ext[1]
ENDIF
IF LCase$(Ext[1]) = "ps"
   Type = "application/postscript"
ENDIF
IF LCase$(Ext[1]) = "bz2"
   Type = "application/x-bzip"
ENDIF
IF LCase$(Ext[1]) = "gz"
   Type = "application/x-gzip"
ENDIF
IF LCase$(Ext[1]) = "tar"
   Type = "application/x-tar"
ENDIF
IF LCase$(Ext[1]) = "doc" OR IF LCase$(Ext[1]) = "rtf"
   Type = "application/msword"
ENDIF
IF LCase$(Ext[1]) = "xls"
   Type = "application/excel"
ENDIF
IF LCase$(Ext[1]) = "pps" OR IF LCase$(Ext[1]) = "ppt"
   Type = "application/vnd.ms-powerpoint"
ENDIF
IF LCase$(Ext[1]) = "swf"
   Type = "application/x-shockwave-flash"
ENDIF
IF LCase$(Ext[1]) = "ods" OR IF LCase$(Ext[1]) = "odp" OR IF
LCase$(Ext[1]) = "odt"
   Type = "application/x-zip"
ENDIF

RETURN Type
END



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by jacky-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jack a écrit :

> deux petites questions concernant smtp.
> 1- lorsque j'envoie un fichier, il est altéré à l'arrivée (taille ridicule) et est illisible
> 2- lorsque j'envoie une piece jointe, le corps du message n'est pas envoyé.
>
> Quelqu'un a-t-il une idée ?

Up.

Y'a que moi qui aie ce problème ?




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Jack a écrit :
> > deux petites questions concernant smtp.
> > 1- lorsque j'envoie un fichier, il est altéré à l'arrivée (taille
> > ridicule) et est illisible 2- lorsque j'envoie une piece jointe, le corps
> > du message n'est pas envoyé.
> >
> > Quelqu'un a-t-il une idée ?
>
> Up.
>
> Y'a que moi qui aie ce problème ?
>

"Chez moi ça marche" (tm). Serait-il possible d'avoir tous les détails, la
version de Gambas, le code exécuté, etc. (comme d'habitude...)

--
Benoît

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by jacky-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoît Minisini a écrit :
> "Chez moi ça marche" (tm). Serait-il possible d'avoir tous les détails, la
> version de Gambas, le code exécuté, etc. (comme d'habitude...)
>


Bonsoir Benoit,

sur ma form quand je clique sur le bouton d'envoi.

Mail.Envoi(Adr_mail, TextBox1.Text, sText.Text, piece, TextBox2.text,
TypeM, FileN)

Adr_mail = adresse mail
Textbox1.Text = Sujet
sText.Text = Texte du mail
piece = booléen si il y a une piece jointe.
Textbox2.Text =  chemin et nom du fichier joint
TypeM = type mime de la piece jointe
Filen = nom du fichier joint


'procédure d'envoi.
PUBLIC SUB Envoi(Email AS String, sujet AS String, Txt AS String, piece
AS Boolean, chemin AS String, TypeM AS String, FileN AS String)
   DIM Hmail AS NEW SmtpClient
   WITH Hmail
   IF NOT IsNull(EMail) THEN
     .Host = Settings["/Smtp"]
     .From = Settings["/Adrmail"]
     .Subject = sujet
     .Alternative = FALSE
     .To.Add(Email)
     .Add(Txt, "text/plain;charset=utf-8")
     IF piece = TRUE THEN
       .Add(chemin, TypeM, FileN)
     ENDIF
     TRY .Send()
     IF ERROR THEN Message.Error("Veuillez vérifier la configuration de
vos coordonnées mail dans les préférences SVP !")
   ENDIF
   END WITH
END

Qu'est-ce qui cloche dans mon code ?

Ubuntu 9.04,  dernière version svn de Gambas

Merci de bien vouloir jeter un oeil sur mon code Benoit.



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Benoît Minisini a écrit :
> > "Chez moi ça marche" (tm). Serait-il possible d'avoir tous les détails,
> > la version de Gambas, le code exécuté, etc. (comme d'habitude...)
>
> Bonsoir Benoit,
>
> sur ma form quand je clique sur le bouton d'envoi.
>
> Mail.Envoi(Adr_mail, TextBox1.Text, sText.Text, piece, TextBox2.text,
> TypeM, FileN)
>
> Adr_mail = adresse mail
> Textbox1.Text = Sujet
> sText.Text = Texte du mail
> piece = booléen si il y a une piece jointe.
> Textbox2.Text =  chemin et nom du fichier joint
> TypeM = type mime de la piece jointe
> Filen = nom du fichier joint
>
>
> 'procédure d'envoi.
> PUBLIC SUB Envoi(Email AS String, sujet AS String, Txt AS String, piece
> AS Boolean, chemin AS String, TypeM AS String, FileN AS String)
>    DIM Hmail AS NEW SmtpClient
>    WITH Hmail
>    IF NOT IsNull(EMail) THEN
>      .Host = Settings["/Smtp"]
>      .From = Settings["/Adrmail"]
>      .Subject = sujet
>      .Alternative = FALSE
>      .To.Add(Email)
>      .Add(Txt, "text/plain;charset=utf-8")
>      IF piece = TRUE THEN
>        .Add(chemin, TypeM, FileN)
>      ENDIF
>      TRY .Send()
>      IF ERROR THEN Message.Error("Veuillez vérifier la configuration de
> vos coordonnées mail dans les préférences SVP !")
>    ENDIF
>    END WITH
> END
>
> Qu'est-ce qui cloche dans mon code ?

Aucune idée, je n'ai pas le contenu des arguments de la fonction. Il faut
montrer le projet entier.

Et m'envoyer un mail pour que je constate de visu la corruption.

--
Benoît

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by jacky-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoît Minisini a écrit :
>> Benoît Minisini a écrit :
>>> "Chez moi ça marche" (tm). Serait-il possible d'avoir tous les détails,
>>> la version de Gambas, le code exécuté, etc. (comme d'habitude...)
>> Bonsoir Benoit,

Bonjour Benoit,

si ca fonctionne ça doit donc venir de mon code. Je vais l'éplucher pour
essayer de trouver.
Je te tiendrai au courant.

Cordialement.

Jack




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr

Re: Smtp

by Fabien Bodard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

jack , envoit moi un de ces mail stp que je vois de quoi il retourne


2009/9/3 Jack <jscops@...>:

> Benoît Minisini a écrit :
>>> Benoît Minisini a écrit :
>>>> "Chez moi ça marche" (tm). Serait-il possible d'avoir tous les détails,
>>>> la version de Gambas, le code exécuté, etc. (comme d'habitude...)
>>> Bonsoir Benoit,
>
> Bonjour Benoit,
>
> si ca fonctionne ça doit donc venir de mon code. Je vais l'éplucher pour
> essayer de trouver.
> Je te tiendrai au courant.
>
> Cordialement.
>
> Jack
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user-fr mailing list
> Gambas-user-fr@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user-fr
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user-fr mailing list
Gambas-user-fr@...
https://lists.sourceforge.net/lists/listinfo/gambas-user-fr