Solved

MAPIMessage.Send False  (buggy?)

Posted on 1998-09-29
2
516 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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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

11 Experts available now in Live!

Get 1:1 Help Now