Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
669 connectés 

  FORUM HardWare.fr
  Programmation
  C#/.NET managed

  comment ouvrir le client de messagerie par défaut en c# ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

comment ouvrir le client de messagerie par défaut en c# ?

n°1535992
drone
Posté le 29-03-2007 à 17:32:04  profilanswer
 

hello,
 
Ce que je souhaite faire correspond à un mailto, ex mailto:toto@toto.com mais en c#, j'ai presque réussi en utilisant un objet de la classe Process (system.diagnostics.process), le processus de mon client de messagerie (outlook.exe pour moi) est bien chargé mais rien n'apparait à l'écran.
 
Si qq a une idée pourquoi ma fenêtre ne s'affiche pas ou une autre méthode.
merci d'avance
 
voici un morceau de mon code:

Code :
  1. string strMailTo = "mailto:toto@toto.com";
  2. System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
  3. myProcess.StartInfo.UseShellExecute = true;
  4. myProcess.StartInfo.RedirectStandardOutput = false;
  5. myProcess.StartInfo.FileName = strMailTo;
  6. myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
  7. myProcess.Start();


mood
Publicité
Posté le 29-03-2007 à 17:32:04  profilanswer
 

n°1536027
_Mose_
Lonesome coder
Posté le 29-03-2007 à 18:19:55  profilanswer
 

Et en enlevant tous les détails ?

Code :
  1. System.Diagnostics.Process.Start("mailto:toto@toto.com" );

n°1537453
drone
Posté le 02-04-2007 à 17:08:05  profilanswer
 

_Mose_ a écrit :

Et en enlevant tous les détails ?

Code :
  1. System.Diagnostics.Process.Start("mailto:toto@toto.com" );



 
ça fait pareil  :(

n°1537533
Lamarmotte
Posté le 02-04-2007 à 20:55:06  profilanswer
 

Hello, J'utilise une petite classe perso qui fonctionne bien pour moi.

Code :
  1. Imports System
  2. Imports System.Diagnostics
  3. Public Class MailTo
  4.     Private Function FormatRecipient(ByVal oList As List(Of String)) As String
  5.         Return String.Join(";", oList.ToArray())
  6.     End Function
  7.     Public Sub Mailto(ByVal oRecipient As List(Of String), ByVal sSubject As String, ByVal sBody As String)
  8.         Dim sCmd As String
  9.         sCmd = "mailto:"
  10.         sCmd += FormatRecipient(oRecipient)
  11.         sCmd += "?"
  12.         sCmd += "subject=" & sSubject
  13.         sCmd += "&body="
  14.         sCmd += sBody
  15.         Dim oInfo As New System.Diagnostics.ProcessStartInfo(sCmd)
  16.         Dim oProcess As New System.Diagnostics.Process
  17.         oProcess.StartInfo = oInfo
  18.         Try
  19.             oProcess.Start()
  20.         Catch ex As Exception
  21.             MessageBox.Show(ex.ToString())
  22.         End Try
  23.     End Sub
  24. End Class

n°1537621
drone
Posté le 03-04-2007 à 09:47:43  profilanswer
 

Lamarmotte a écrit :

Hello, J'utilise une petite classe perso qui fonctionne bien pour moi.

Code :
  1. Imports System
  2. Imports System.Diagnostics
  3. Public Class MailTo
  4.     Private Function FormatRecipient(ByVal oList As List(Of String)) As String
  5.         Return String.Join(";", oList.ToArray())
  6.     End Function
  7.     Public Sub Mailto(ByVal oRecipient As List(Of String), ByVal sSubject As String, ByVal sBody As String)
  8.         Dim sCmd As String
  9.         sCmd = "mailto:"
  10.         sCmd += FormatRecipient(oRecipient)
  11.         sCmd += "?"
  12.         sCmd += "subject=" & sSubject
  13.         sCmd += "&body="
  14.         sCmd += sBody
  15.         Dim oInfo As New System.Diagnostics.ProcessStartInfo(sCmd)
  16.         Dim oProcess As New System.Diagnostics.Process
  17.         oProcess.StartInfo = oInfo
  18.         Try
  19.             oProcess.Start()
  20.         Catch ex As Exception
  21.             MessageBox.Show(ex.ToString())
  22.         End Try
  23.     End Sub
  24. End Class



 
je l'ai adapté en c# mais ça fait toujours la même chose.


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C#/.NET managed

  comment ouvrir le client de messagerie par défaut en c# ?

 

Sujets relatifs
Internet explorer ne peut ouvrir la page[eclipse] Comment ouvrir Editor dans nouvelle fenêtre?
problème jeux devinette client/serveur[C] Client/Serveur : tchat, envoi à tous les clients
ouvrir une fenêtre de taille controlée, sans les menus ni les boutonsouvrir un fichier sur un lecteur réseau en php
[sql*loader] valeur par defaut[C#][.net] Ouvrir un popup, effectuer des saisies dans le popup (ASPX)
[HTML] Ouvrir nouvelle fenetre ET fermer l'ancienneouvrir un fichier son avec javascript
Plus de sujets relatifs à : comment ouvrir le client de messagerie par défaut en c# ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR