Read the content of email and text attachment

hi,

if i receive job-order/sales-order in an email, ...
(a) how can i use visual basic 6.0 to assign the contents to a eg...memo.textRTF,
(b) and also to handle an attachment (eg. job.csv) , say save it to a temp folder. ( i guess the next thing is just to open the job.csv and read the contents.)

thanks.
FiacreAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nffvrxqgrcfqvvcCommented:
Start new project
Add the microsoft mapi controls
name MapiSessions1 to: mapsess
name MapiMessages1 to : mapmess

'ADD 2 command buttons
'ADD 1 Textbox ..If you must change textbox 1 to a richtextbox

'Copy and Paste code into form


Option Explicit
Dim strMessageCount As String
Dim strPrintMessage As String
Dim bNewSession
Private Function LogOn() As Boolean

    If mapSess.NewSession Then
        MsgBox "Session already established"
        Exit Function
    End If
    On Error GoTo errLogInFail
    With mapSess
        .DownLoadMail = False
        .LogonUI = True
        .SignOn
        LogOn = True
        .NewSession = True
        bNewSession = .NewSession
        mapMess.SessionID = .SessionID
    End With
    Exit Function
   
errLogInFail:
    Debug.Print Err.Number, Err.Description
    If Err.Number = 32003 Then
        MsgBox "Canceled Login"
        LogOn = False
    End If
    Exit Function
End Function
Private Sub Fetch()

    With mapMess
        .FetchUnreadOnly = False
        .Fetch
        strMessageCount = LTrim(Str(.MsgIndex + 1)) & " of " & LTrim(Str(.MsgCount))
    strPrintMessage = .MsgNoteText
    Debug.Print strMessageCount
    Text1.Text = strPrintMessage
    End With
End Sub

Private Sub Command2_Click()
With mapMess
If .MsgIndex < .MsgCount - 1 Then
        .MsgIndex = .MsgIndex + 1
        Debug.Print strMessageCount
        strPrintMessage = .MsgNoteText
        Text1.Text = strPrintMessage
    Else
        Debug.Print "End of e-mail messages"
    End If
    End With
   
End Sub

Private Sub Form_Load()
Command1.Caption = "read mail"
Command2.Caption = "read next mail"
LogOn
Fetch
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FiacreAuthor Commented:
hi,
does your above codes help to read any attachment that is CSV or TXT extension ?

For another question, i have posted in a new thread, related to this. (Qn: How to transfer email read/opened to another folder ?)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.