Solved

MAPIMessage.Send False  (buggy?)

Posted on 1998-09-29
2
519 Views
Last Modified: 2008-02-20
Well here's the deal, if I use:
     MAPIMessages1.Send True  
it pops up the dialog box, i hit send, and Bang! no problem the e-mail gets sent. On the other hand if i use:
     MAPIMessages1.Send False
it doesn't pop up the dialog box (that's what the false is for, or at least that's what it says in VB5 on-line help),it doesn't generate any kind of error, BUT it also doesn't send the e-mail.... i'm very confused.  I need to send the e-mails without the dialog box popping up but that seems to be the only way it will work.  Is there something else I must do if I don't make the dialog box pop up?  Here is the code I've written.  Thanks alot ya'll:

Private Sub Form_Load()
    '***** Start *****
    Dim atlasDir As String
   
    ' this is the directory to be checked for messages
    ' to be sent.
    atlasDir = "e:\atlasSrv\*.dat"
    ChDir "e:\atlasSrv"
   
    Do
        DoEvents
        fileName = Dir(atlasDir)
    Loop Until fileName <> ""
   
    atlasSignOn
    readRecords (atlasDir)
    MAPISession1.SignOff
    End
    '***** End *****
End Sub
Sub atlasSignOn()
    MAPISession1.UserName = "xxxxxxxxx"
    MAPISession1.Password = "xxxxxxxxx"
    MAPISession1.SignOn
    MAPIMessages1.SessionID = MAPISession1.SessionID
End Sub
Sub readRecords(atlasDir As String)
    Dim fileName As String
    Dim atlasSrv As String
    Dim eMailAddress As String
    Dim numFiles As Integer
   
    numFiles = 0
    fileName = Dir(atlasDir)
       
    Do
        If fileName <> "" Then
            Open fileName For Input As #1
            Input #1, eMailAddress
            Close #1
            Call sendMail(eMailAddress, fileName, atlasDir)
            FileCopy fileName, "e:\atlasold\" + fileName
            Kill fileName
        End If
        fileName = Dir
    Loop Until fileName = ""

End Sub
Sub sendMail(eMailAddress2 As String, fileName2 As String, atlasDir2 As String)
    Dim attachPath As String
    Dim attachFile As String
    Dim attachment As String
    Dim location As Integer
   
    location = InStr(1, atlasDir2, "*")
    attachPath = Left(atlasDir2, location - 1)
    location = InStr(1, fileName2, ".")
    attachFile = Left(fileName2, location) + "htm"
    attachment = attachPath + attachFile
   
    MAPIMessages1.Compose
    MAPIMessages1.RecipAddress = eMailAddress2
    MAPIMessages1.RecipDisplayName = eMailAddress2
    MAPIMessages1.MsgSubject = "Atlas Report"
    MAPIMessages1.AttachmentPosition = 14
    MAPIMessages1.AttachmentPathName = attachFile
    MAPIMessages1.MsgNoteText = "Atlas Report." + Chr$(13) + " "
    MAPIMessages1.Send False
       
    FileCopy attachFile, "e:\atlasold\" + attachFile
    Kill attachFile
End Sub
0
Comment
Question by:jasonellis
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
vmano earned 50 total points
ID: 1437250
here is the code:
'MSes is the MapiSession control and
'MMes is the MAPIMessages Control.

MSes.SignOn
MMes.SessionID = MSes.SessionID
With MMes
     .MsgIndex = -1
     Do While .RecipCount > 0
         .RecipIndex = 0
         .Delete 1
     Loop
     .RecipIndex = 0
     .RecipAddress = emailaddress2
     .ResolveName
     .MsgType = "IPM.Note.VersionControl"
     .MsgSubject = "test message"
     .MsgNoteText = " test message " 
     .Send false
End With
MSes.SignOff
0
 
LVL 3

Expert Comment

by:vmano
ID: 1437251
the above code works for me.you can make changes to include your attachment file, kill attachment file and so on.
vmano

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now