phobia
Terugkerende gebruiker
- Lid geworden
- 4 sep 2006
- Berichten
- 1.777
Kan iemand mij uitleggen hoe ik meerdere bijlagen kan versturen?
Ik mail met onderstaande code!
Ik mail met onderstaande code!
Code:
Function SendEmail(AanEmailAdres As String, onderwerp As String, TekstHTML As String, Bijlage As String)
Dim x As String
Dim objMessage
Set objMessage = CreateObject("CDO.Message")
'==Opzoeken van server gegevens.
strSQL = "SELECT * FROM tblServer WHERE actief = true"
Set db = CurrentDb
Set RS = db.OpenRecordset(strSQL)
RS.MoveFirst
Do While Not RS.EOF
'==Onderwerp mail
objMessage.subject = onderwerp
'==Afzender mail
objMessage.FROM = RS!emailgebruiker
'==Ontvanger mail
objMessage.To = AanEmailAdres
'==Mail met HTML ody opmaken.
objMessage.HTMLBody = TekstHTML
'==Bijlage bij mail voegen.
If Not Bijlage = "" Or Bijlage = Null Then
strBijlage = "" & Bijlage & ""
objMessage.AddAttachment strBijlage
End If
' Voeg bijlagen toe aan het bericht.
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = RS!smtpserver
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = RS!gebruikersnaam
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = RS!wachtwoord
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
'==Mail verzenden.
objMessage.Send
Set objMessage = Nothing
RS.MoveNext
Loop
RS.Close
End Function