Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: How to use MAPI


Message #1 by "Andrew Huang" <imcityhunter@o...> on Tue, 17 Apr 2001 12:33:04 -0700

hi,

   I tried the following code and it worked.

    If session.NewSession Then
        MsgBox "A session has already started"
       
    Else
   
        'create a MAPI Session to send a mail.
        session.SignOn
        session.NewSession =3D True
        message.SessionID =3D session.SessionID
        message.Compose
        message.RecipAddress =3D "someone@s..."
        message.MsgNoteText =3D <Your Message goes here>
        message.MsgSubject =3D <Your Subject Goes here>
        message.Send True
        session.SignOff
        session.NewSession =3D False
    End If

    It will invoke your default mail client (either Outlook express or 
Netscape communicator - I tried with both and it worked again..)

Hope this helps,

N.T.GOPALAKRISHNAN
  ----- Original Message -----
  From: Kim, Cardyin
  To: professional vb
  Sent: Wednesday, April 18, 2001 3:03 AM
  Subject: [pro_vb] RE: How to use MAPI


  The code that you are using implies
  that you have a MAPI compliant
  email software installed on your machine.

  At our hospital, we use Microsoft
  Exchange client and Outlook 98 and 2000
  (not Outlook Express) with the
  exchange client installed to send email
  using the method you described.

  Cardyin

  --------------------------------------
  Cardyin Kim
  C/S & Web Development Analyst
  Information Services
  San Antonio Community Hospital
  ckim@s...     (xxx)xxx-xxxx    
  --------------------------------------


  -----Original Message-----
  From: Andrew Huang [mailto:imcityhunter@o...]
  Sent: Tuesday, April 17, 2001 12:33 PM
  To: professional vb
  Subject: [pro_vb] How to use MAPI


  How to use MAPI control to send email from VB App.

  Please take look at the fellowing code. I don't know what's wrong but
  I keep getting the

  System Undeliverable message
  No transport provider was available for delivery to this recipient.


  Private Sub Command1_Click()
      MAPISession1.UserName =3D "Test"
      MApISession1.Password =3D "TestMail"
      MAPISession1.SignOn
     
     
      If MAPISession1.SessionID <> 0 Then
     
     
          With MAPIMessages1
              .SessionID =3D MAPISession1.SessionID
              .Compose
              .RecipDisplayName =3D "Andrew"
              .RecipAddress =3D "imcityhunter@o..."
              .MsgSubject =3D "SUBJECT"
              .MsgNoteText =3D "Message"
              .Send False
          End With
          MAPISession1.SignOff
      End If

  End Sub

  --
  Andrew Huang
  imcityhunter@o... - email
   (xxx) xxx-xxxx  x3234 - voicemail/fax


  ---
  

  Return to Index