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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ideas on how to import e-mail into access 2000 1

Status
Not open for further replies.

fogal

Technical User
Aug 20, 2001
87
US
I currently use lotus notes v5.08 and access 2000. I have code to send e-mail automatically. I now need to find a way to import mail messages.

I've tried, but can not find a way to export a message from a pre-defined view in notes using vba code. If I could export a message to a text document, I could then easily import it into a table in access.
Here is the code to send mail:
All ideas welcome!

Option Compare Database
Option Explicit

' Declare Lotus Notes variables
Public domDocument As NotesDocument
Public domViewEntry As NotesViewEntry
Public domView As NotesView
Public domViewNav As NotesViewNavigator
Public domSession As New notesSession
Public DomDbDir As NotesDbDirectory
Public DomDbMail As NotesDatabase
Public DomDbTobeInvestigate As NotesDatabase
Public DomDb As NotesDatabase

Public Function mailer3()
On Error Resume Next
Dim sdir As String
Dim semail As String
Dim sforename As String

domSession.Initialize (Forms![frm_email_information]![txtPassword])

sdir = Nz(Forms![frm_email_information]![txtAttachment], "")
semail = "a@c.com"
sforename = ""

mailer4 semail, sdir, sforename

End Function
Public Function mailer4(sReciprient As String, sAttachment As String, sName As String)
'sends mail to person

On Error Resume Next

Dim DomDoc As NotesDocument
Dim DomItem1 As NotesItem
Dim DomItem2 As NotesItem
Dim DomItem3 As NotesItem
Dim DomItem4 As NotesItem
Dim DomItem5 As NotesItem
Dim DomItem6 As NotesItem
Dim Item1, Item2, Item3, Item4
Dim at As NotesItem
Dim DomRtpStyle As NotesRichTextParagraphStyle
Dim DomRtStyle As NotesRichTextStyle
Dim Object As NotesEmbeddedObject
Dim AttachMe As NotesRichTextItem
Dim embedobj As NotesEmbeddedObject

Const pos = 1440 ' 1440 twips = 1 Inch
Const interval = 537 ' 537 twips = 1 centimeter
Dim StrMyCell As String
Dim StrMsg(17) As String
Dim IntTmpK As Integer
Dim IntTmpI As Integer
Dim txtSub As String

Set DomDbDir = domSession.GetDbDirectory("")
Set DomDbMail = DomDbDir.OpenMailDatabase()

Set DomDoc = DomDbMail.CreateDocument ' create a mail DomDocument

'set up attachment if it exists
If Not sAttachment = "" Then
Set AttachMe = DomDoc.CreateRichTextItem("Attachment")

Set embedobj = AttachMe.EmbedObject(1454, "", Forms![frm_email_information]![txtAttachment], Forms![frm_email_information]![txtAttachment])
End If
Set DomItem1 = DomDoc.ReplaceItemValue("Form", "memo")

' sends subject if it exists

txtSub = IIf(IsNull(Forms![frm_email_information]![txtSubject]), "", Forms![frm_email_information]![txtSubject])

Set DomItem2 = DomDoc.ReplaceItemValue("sendTo", sReciprient)
Set DomItem3 = DomDoc.ReplaceItemValue("Subject", txtSub)

StrMsg(0) = "abc MAIL SERVICES" & Chr(10) & Chr(10)
StrMsg(1) = "All, " & sName
StrMsg(2) = IIf(IsNull(Forms![frm_email_information]![txtmessage]), "", Forms![frm_email_information]![txtmessage]) & Chr(10) & Chr(10) & Chr(10) & Chr(10)
StrMsg(3) = "Kind Regards."
Set DomRtpStyle = domSession.CreateRichTextParagraphStyle
Set DomRtStyle = domSession.CreateRichTextStyle

Call DomRtpStyle.SetTabs(3, pos, interval, TAB_DECIMAL)
DomRtStyle.NotesColor = COLOR_DARK_BLUE

Set Item4 = DomDoc.CreateRichTextItem("Body")
Call Item4.AppendParagraphStyle(DomRtpStyle)
Call Item4.AppendStyle(DomRtStyle)

For IntTmpI = 0 To 16 Step 2

IntTmpK = IntTmpI
Call Item4.AppendText(StrMsg(IntTmpK))

Call Item4.AppendText(StrMsg(IntTmpK + 1))

If (IntTmpK = 0) Or (IntTmpK = 2) Then
Call Item4.AddNewLine(1)
End If
Call Item4.AddNewLine(1)

Next

DomDoc.Send (False)

Set domSession = Nothing
Set AttachMe = Nothing
Set DomDbDir = Nothing
Set DomDbMail = Nothing
Set DomDoc = Nothing
Set embedobj = Nothing
Set domDocument = Nothing
Set domViewEntry = Nothing
Set domView = Nothing
Set domViewNav = Nothing
Set DomItem1 = Nothing
Set DomItem2 = Nothing
Set DomItem3 = Nothing
Set DomRtpStyle = Nothing
Set DomRtStyle = Nothing
Set Item4 = Nothing
End Function
 
I'm also looking for a way to download emails from Lotus Notes.

I get alot of emails from various mailing lists, and I want to be able to download them into text files easily. When I try to do this manually, if the file is to big, then the email message get's garbled.

If I could do this via programming, I could have a different file for each mail message, then cmobine them all for each month.

I have the ITSO book called LotusScript for Visual Basic Programmers, but it is not much help in this instance.

If anyone out there knows how to get the individual emails out of lotus notes, I would appreciate it.

I know that it can be done in Outlook, but I don't have outlook at work.. we only have Lotus Notes (R5.0.10).

Gcomyn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top