Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reaching e-mail Components from MS Access

Status
Not open for further replies.

KiaKia

Programmer
Joined
Mar 30, 2008
Messages
59
Location
US
HI Everybody,
I wonder to know if there is any way to have access to an e-mail component like the Subject, Reciepents or Sender from an MS Access form.

 
Have a look at SendObject.
 
For sending use

1) Sendobject (simplest)

2) Link to Outlook (gives you much more control over the email)

3) Use direct connection - OstroSoft do a decent dll with sample code that works.

For receiving use

1) Link to outlook using wizard - limits the fields

2) Full link to outlook received objects

3) Ostrosoft again



SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Hi Hap,
I try to read the incoming e-mails and I am using outlook.
Kia

 
Here are some notes.

Code:
Sub ListMail()
Dim oApp As Outlook.Application
Dim oNS As NameSpace
Dim oRecItems As Outlook.MAPIFolder
Dim oFilterRecItems As Items
Dim oNewMail As Outlook.MailItem
Dim strFilter As String
Dim dteLastCheck As Date
Dim dteThisCheck As Date
Dim strNewMessage As String
Dim i

'Check last 30 days emails
dteLastCheck = DateAdd("d", -30, Now())
dteThisCheck = Now()

Set oApp = CreateObject("Outlook.Application")
Set oNS = oApp.GetNamespace("MAPI")

Set oRecItems = oNS.GetDefaultFolder(olFolderInbox)
strFilter = "[ReceivedTime] > " _
          & Chr(34) & Format(dteLastCheck, "dd/mm/yyyy hh:nn") & Chr(34) _
          & " AND [ReceivedTime] < " _
          & Chr(34) & Format(dteThisCheck, "dd/mm/yyyy hh:nn") & Chr(34)
Set oFilterRecItems = oRecItems.Items.Restrict(strFilter)

'Print results to the immediate window.
Debug.Print = "Number of emails: " & oFilterRecItems.Count & vbCrLf
For i = 1 To oFilterRecItems.Count
    Debug.Print _
    oFilterRecItems(i).ReceivedTime & vbCrLf _
    & oFilterRecItems(i).To & vbCrLf _
    & oFilterRecItems(i).EntryID & vbCrLf ' _
    & oFilterRecItems(i).Body & vbCrLf
Next

Set oFilterRecItems = Nothing
Set oNS = Nothing
Set oApp = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top