cs_you
Messages postés6Date d'inscriptionvendredi 22 février 2002StatutMembreDernière intervention 6 mai 2002
-
22 févr. 2002 à 01:52
copiercoder
Messages postés10Date d'inscriptionlundi 22 avril 2002StatutMembreDernière intervention 8 juillet 2002
-
19 mai 2002 à 09:23
comment faire un boutton quand je clique sur ce boutton il envoyer un email à l'adresse qui est dans un textbox avec le messagerie par defaut
BSide
Messages postés88Date d'inscriptionmercredi 13 février 2002StatutMembreDernière intervention18 février 2008 22 févr. 2002 à 14:21
Bonjour,
la question que tu as posée m'intéresse quoique je ne puisse malheureusement pas t'aider.
Pourras-tu me dire quelle solution tu as retenue quand tu auras résolu ton problème ?
NeoTheProgrammer
Messages postés1Date d'inscriptionvendredi 22 février 2002StatutMembreDernière intervention22 février 2002 22 févr. 2002 à 20:57
Voici un exemple de code qui pourra t'aider...
Il faut ajouter une reference dans ton projet : Microsoft Outlook x.0
Je l'ai essayé et ça marche tres bien... il faut que la messagerie soit ouverte...
PDest = "Titi@titi.com"
Pcopy = "Toto@toto.com"
Psubject = "Envoie d'un mail avec VB..."
PNoteText = "Bla bla bla..."
PFile = ""
'SendMessage(DisplayMsg As Boolean, PDest As String, Pcopy As String, Optional Psubject, Optional PNoteText, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(PDest)
objOutlookRecip.Type = olTo
If Pcopy = "" Then
Else
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Pcopy)
objOutlookRecip.Type = olCC
End If
' Add the BCC recipient(s) to the message.
' Set objOutlookRecip = .Recipients.Add("MARECHAL")
' objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Emission Automatique : " & Psubject
.Body = PNoteText
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
' Set objOutlookAttach = .Attachments.Add(AttachmentPath)
'End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Send
End If
End With
Set objOutlook = Nothing