?
Solved

MAPIMessage.Send False  (buggy?)

Posted on 1998-09-29
2
Medium Priority
?
566 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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