?
Solved

MAPIMessage.Send False  (buggy?)

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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 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…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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