1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| Private Sub Command253_Click()
On Error GoTo Err_Command253_Click
' ---
' TEST DE L'ENVOI DE MAIL
' ---
'Public Sub TestEmail()
Dim strDest As String ' L'adresse e-mail du destinataire
Dim strMessage As String ' Le corps du message
' Création du corps du message
strMessage = "Voici un petit exemple illustrant la"
strMessage = strMessage & vbCrLf & "la possibilité d'expédier un e-mail"
strMessage = strMessage & vbCrLf & "depuis Microsoft Access."
strMessage = strMessage & vbCrLf & vbCrLf & "The Big Boss"
strMessage = strMessage & vbCrLf & " -----------------------------------"
' On demande l'adresse e-mail du destinataire
strDest = InputBox("Tapez une adresse e-mail existante : ", _
"Messagerie Access", _
"Bill_gates@Microsoft.com")
If strDest = "" Then Exit Sub
' Envoi du message
SendMail strDest, _
"** Email depuis Access **", _
strMessage, _
True
'End Sub
Exit_Command253_Click:
Exit Sub
Err_Command253_Click:
MsgBox Err.Description
Resume Exit_Command253_Click
End Sub
' ---
' ENVOYER UN MAIL DEPUIS ACCESS
' ---
' Entrée : strEmail <- Adresse e-mail du destinataire
' strObj <- Objet du courrier
' strMsg <- Corps du message
' blnEdit <- True pour pouvoir modifier le courrier avant envoi
' False pour expédier le courrier directement.
'
Public Sub SendMail(ByVal strEmail As String, _
ByVal strObj As String, _
ByVal strMsg As String, _
ByVal blnEdit As Boolean)
On Error Resume Next
DoCmd.SendObject acSendNoObject, , , strEmail, , , strObj, strMsg, blnEdit
End Sub |
Partager