Solved

MAPIMessage.Send False  (buggy?)

Posted on 1998-09-29
2
533 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
A macro to Count the number of rows across all worksheets 3 151
how to know if my Checkbox is True in VB6.0? 9 66
Child Form in front 4 58
Automatic Email Reminder 4 78
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

697 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