Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problems with MAPI.

vvang10vvang10 Member Posts: 2

Hi all,

I have been using MAPI component to compose and send e-mails. These e-mails are
not seen by the user and I use the following code:

MAPISession1.SignOn

MAPIMessages1.SessionID = MAPISession1.SessionID

MAPIMessages1.Compose
MAPIMessages1.RecipAddress = "xxx@xxxx.com"
MAPIMessages1.MsgSubject = "Subject here...."
MAPIMessages1.MsgNoteText = "Here is the body message..."

MAPIMessages1.AttachmentType = mapData

MAPIMessages1.AttachmentName = "test.doc"
MAPIMessages1.AttachmentPathName = "c: est.doc"

MAPIMessages1.send False

MAPISession1.SignOff

I set : MAPIMessages1.send --> False so that the compose window will not appear.

The above code works fine on Netscape 4.72 but for Netscape 7.0 or Outlook the code
doesn't send the e-mail (no errors produced though). Does anyone knows what could
have gone wrong? Is there any other way to send e-mails for all available mailers?

Thanks in advance.

vvang10

Comments

  • leeosleeos Member Posts: 1,212
    :
    : Hi all,
    :
    : I have been using MAPI component to compose and send e-mails. These e-mails are
    : not seen by the user and I use the following code:
    :
    : MAPISession1.SignOn
    :
    : MAPIMessages1.SessionID = MAPISession1.SessionID
    :
    : MAPIMessages1.Compose
    : MAPIMessages1.RecipAddress = "xxx@xxxx.com"
    : MAPIMessages1.MsgSubject = "Subject here...."
    : MAPIMessages1.MsgNoteText = "Here is the body message..."
    :
    : MAPIMessages1.AttachmentType = mapData
    :
    : MAPIMessages1.AttachmentName = "test.doc"
    : MAPIMessages1.AttachmentPathName = "c: est.doc"
    :
    : MAPIMessages1.send False
    :
    : MAPISession1.SignOff
    :
    : I set : MAPIMessages1.send --> False so that the compose window will not appear.
    :
    : The above code works fine on Netscape 4.72 but for Netscape 7.0 or Outlook the code
    : doesn't send the e-mail (no errors produced though). Does anyone knows what could
    : have gone wrong? Is there any other way to send e-mails for all available mailers?
    :
    : Thanks in advance.
    :
    : vvang10


    i used the mapi control some time ago.. i think after you attatch that you need to .Update your message.

    If thats does not work.. then i think you need yo go to 'CDO' collaboration Data Object.

    leeos


  • KhalilDutchKhalilDutch Member Posts: 74
    : :
    : : Hi all,
    : :
    : : I have been using MAPI component to compose and send e-mails. These e-mails are
    : : not seen by the user and I use the following code:
    : :
    : : MAPISession1.SignOn
    : :
    : : MAPIMessages1.SessionID = MAPISession1.SessionID
    : :
    : : MAPIMessages1.Compose
    : : MAPIMessages1.RecipAddress = "xxx@xxxx.com"
    : : MAPIMessages1.MsgSubject = "Subject here...."
    : : MAPIMessages1.MsgNoteText = "Here is the body message..."
    : :
    : : MAPIMessages1.AttachmentType = mapData
    : :
    : : MAPIMessages1.AttachmentName = "test.doc"
    : : MAPIMessages1.AttachmentPathName = "c: est.doc"
    : :
    : : MAPIMessages1.send False
    : :
    : : MAPISession1.SignOff
    : :
    : : I set : MAPIMessages1.send --> False so that the compose window will not appear.
    : :
    : : The above code works fine on Netscape 4.72 but for Netscape 7.0 or Outlook the code
    : : doesn't send the e-mail (no errors produced though). Does anyone knows what could
    : : have gone wrong? Is there any other way to send e-mails for all available mailers?
    : :
    : : Thanks in advance.
    : :
    : : vvang10
    :
    :
    : i used the mapi control some time ago.. i think after you attatch that you need to .Update your message.
    :
    : If thats does not work.. then i think you need yo go to 'CDO' collaboration Data Object.
    :
    : leeos

    Or perhaps after setting the .MsgNoteText just point the .AttachmentPathName to your file and then .send False it.

    The properties you set are already there. The .AttachmentName will be set automatically after telling the control which file is attached.
    And the .AttachmentType is already '0' (DataFile).

    Cheers,

    --KhalilDutch--
  • vvang10vvang10 Member Posts: 2
    : : :
    : : : Hi all,
    : : :
    : : : I have been using MAPI component to compose and send e-mails. These e-mails are
    : : : not seen by the user and I use the following code:
    : : :
    : : : MAPISession1.SignOn
    : : :
    : : : MAPIMessages1.SessionID = MAPISession1.SessionID
    : : :
    : : : MAPIMessages1.Compose
    : : : MAPIMessages1.RecipAddress = "xxx@xxxx.com"
    : : : MAPIMessages1.MsgSubject = "Subject here...."
    : : : MAPIMessages1.MsgNoteText = "Here is the body message..."
    : : :
    : : : MAPIMessages1.AttachmentType = mapData
    : : :
    : : : MAPIMessages1.AttachmentName = "test.doc"
    : : : MAPIMessages1.AttachmentPathName = "c: est.doc"
    : : :
    : : : MAPIMessages1.send False
    : : :
    : : : MAPISession1.SignOff
    : : :
    : : : I set : MAPIMessages1.send --> False so that the compose window will not appear.
    : : :
    : : : The above code works fine on Netscape 4.72 but for Netscape 7.0 or Outlook the code
    : : : doesn't send the e-mail (no errors produced though). Does anyone knows what could
    : : : have gone wrong? Is there any other way to send e-mails for all available mailers?
    : : :
    : : : Thanks in advance.
    : : :
    : : : vvang10
    : :
    : :
    : : i used the mapi control some time ago.. i think after you attatch that you need to .Update your message.
    : :
    : : If thats does not work.. then i think you need yo go to 'CDO' collaboration Data Object.
    : :
    : : leeos
    :
    : Or perhaps after setting the .MsgNoteText just point the .AttachmentPathName to your file and then .send False it.
    :
    : The properties you set are already there. The .AttachmentName will be set automatically after telling the control which file is attached.
    : And the .AttachmentType is already '0' (DataFile).
    :
    : Cheers,
    :
    : --KhalilDutch--
    :


    First of all, thanx for the replies. :)

    After being involved with MAPI for long I found out some things. The Microsoft Outlook does not allow to send e-mails with
    attachments through applications that use MAPI. It's because of a security batch file that Microsoft uses to protect Outlook
    from viruses. Of course you can send e-mails with MAPI but only if you don't have attachments. :(

    So basically even if someone uses CDO will not have any luck with it. To overcome the problem I used Outlook object library
    to create and compose e-mails and then (since I don't want user to manually send the e-mail) I used the Office command bar
    to 'press' the 'Send/Receive' button through my application. The new problem that came with this new approach was the fact
    that the code didn't work for Office 2000 and XP. So, two versions have been implemented, one for Office 2000 and one for
    Office XP. I guess that you can't have everything in life. :)

    For all other mail-clients I use MAPI and it works fine.

    As far as Netscape 7.0 is concerned I couldn't find a solution. Somewhere on the net I found out that all versions after
    Netscape 4.7 have problems with their mail-clients.

    The project has been delivered to the client but I guess that they will come back asking for improvements (especially on
    making e-mail post more automatic). In that case, does anyone knows how to find through code which one is the default
    mail-client? Having that in hand I can use different ideas and code for each mail-client.

    I hope that the above information could be helpfull to some others that still experiment with MAPI. :))

    Thanx again...

    vvang10
  • Shawn CarterShawn Carter Member Posts: 0

    _________ < http://forcoder.org /> free video tutorials and ebooks about \ Perl, PHP, JavaScript, Java, Scratch, Visual Basic .NET, MATLAB, C++, Go, Ruby, Assembly, Delphi, PL/SQL, Visual Basic, Swift, Python, C#, Objective-C, C, R Crystal, Hack, Julia, Dart, Fortran, SAS, Scala, ML, Transact-SQL, Prolog, VBScript, Lua, Lisp, D, Ada, Awk, Bash, LabVIEW, Apex, Clojure, Alice, Rust, FoxPro, Kotlin, Erlang, F#, Scheme, Logo, COBOL, ABAP \ _

Sign In or Register to comment.