Afin de vérifier l'authentification d'une personne qui travail avec nous je voudrais lui envoyer un mail.
Comment vérifier si le mail qu'il saisie est bon ? Comment récupérer l'erreur ?
D'avance merci.
Fabiano
Voici le script que j'utilise pour envoyer ce mail :
Const PourLecture = 1
Const cteAdresseSource = "contact@MaSociete.com"
Const ServeurSMTP = "smtp.MaSociete.com"
Private Sub EnvoieEmail()
Dim objMail As Object
Dim sDestination As String
Dim sPieceJointe As String
Dim msgTitre As String
Dim msgTexte As String
Dim Drapeau As Boolean
objMail = CreateObject("CDO.Message")
Drapeau = False
sDestination = "destinataire@MaSociete.com"
msgTitre = "Automatisme"
msgTexte = "Bonjour," & vbLf & "Corps du message"
sPieceJointe = "D:\Monfichier.txt"
Drapeau = True
With objMail
.From = cteAdresseSource
.To = sDestination
.Subject = msgTitre
If (sPieceJointe <> "") Then
.TextBody = msgTexte & vbLf & "Pièce jointe incluse : " & vbLf
Else
.TextBody = msgTexte & vbCrLf & "Aucune Pièce jointe" & vbCrLf
End If
.Configuration.Fields("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = ServeurSMTP
.Configuration.Fields("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Update()
If ((sPieceJointe <> "") And (Drapeau = False)) Then
objMail.AddAttachment(sPieceJointe)
End If
.Send()
End With
objMail = Nothing
MsgBox("Courriel envoyé !")
End Sub