[VB / ms acces] interne mail (microsoft mail) vanuit access.

Pagina: 1
Acties:

  • airbrain
  • Registratie: November 2000
  • Laatst online: 26-09-2025
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.

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

Verwijderd

hoe geef je de recipient mee dan? Als Jansen, Henk of als henk.jansen@hallo.com?

In het geval van de tweede moet het volgens mij gewoon werken

  • airbrain
  • Registratie: November 2000
  • Laatst online: 26-09-2025
Recipient die meegegeven wordt bij externe mail is "naam@naambedrijf.nl". Bij interne mail (microsoft mail), wordt naar mijn idee "naampostbus" meegegeven en "naampostkantoor", maar dat weet ik niet zeker, gezien het feit dat bij het via outlook versturen van interne mail altijd gaat met het toevoegen van personen in het 'to' en 'cc' veld via het adresboek van het microsoft mail postkantoor. Daarom weet ik niet precies wat er meegegeven wordt.

[ Voor 64% gewijzigd door airbrain op 10-11-2004 15:10 ]