Hey allen,
Ik heb hier een ms access database waarin een formulier (contactpersonen) met subformulier (vragen) staat. Op dit subformulier heb ik een knop geplaatst waarmee bepaalde velden van het huidige record automatisch gemaild worden naar het emailadres wat in een veld van het huidige record staat. Dit werkt prima met externe mail via smtp. Echter ik wil het ook graag werkend krijgen met interne emailadressen die via microsoft mail behandeld worden. Nu krijg ik de melding " 'naam_van_intern_account' wordt niet herkend ". Kan iemand me hiermee helpen? Voor de duidelijkheid hieronder mijn code welke dus werkt met externe emailadressen. Nu nog de interne adressen.
Ik heb hier een ms access database waarin een formulier (contactpersonen) met subformulier (vragen) staat. Op dit subformulier heb ik een knop geplaatst waarmee bepaalde velden van het huidige record automatisch gemaild worden naar het emailadres wat in een veld van het huidige record staat. Dit werkt prima met externe mail via smtp. Echter ik wil het ook graag werkend krijgen met interne emailadressen die via microsoft mail behandeld worden. Nu krijg ik de melding " 'naam_van_intern_account' wordt niet herkend ". Kan iemand me hiermee helpen? Voor de duidelijkheid hieronder mijn code welke dus werkt met externe emailadressen. Nu nog de interne adressen.
Visual Basic 6:
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
55
| Public Function SendEMail(Optional AttachmentPath) Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Dim mailadres As String mailadres = Forms!Contactpersonen!Emailadres Dim Vraag As String Vraag = Forms!Contactpersonen!VragenSubformulier.Form!Vraag ' 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(mailadres) objOutlookRecip.Type = olTo ' Add the CC recipient(s) to the message. 'Set objOutlookRecip = .Recipients.Add("cc_adres") 'objOutlookRecip.Type = olCC ' Set the Subject, Body, and Importance of the message. .Subject = "Dit is een email vanuit access" .Body = Vraag '.Body = Vraag & vbCrLf & vbCrLf .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 If Not objOutlookRecip.Resolve Then objOutlookMsg.Display End If Next .Send End With Set objOutlookMsg = Nothing Set objOutlook = Nothing End Function |