Expediteur="facultatif@tonhébergeur"
Destinataire="adresse@hébergeur"
BCC="facultatifs"
Objet="coucou"
Corps="Texte du corps de message"
PieceJointe="C:\etc..."
MailEnvoi Expediteur,Destinataire,Objet,Corps,PieceJointe
Sub MailEnvoi(Exped,Dest,Objet,body,pj)
Set iConfig = CreateObject("CDO.Configuration" )
With iConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = "serveur smtp" .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" ) = 10
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = 25 .Update
End With
Set objEmail = CreateObject("CDO.Message" )
objEmail.Configuration = iConfig
objEmail.From = Exped
objEmail.To = Dest
objEmail.Bcc = BCC
objEmail.Subject = Objet
objEmail.Textbody = body
objEmail.AddAttachment pj
objEmail.Send()
End Sub |