Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

MAPISendMail with BC5

MAPISendMail with BC5

MAPISendMail with BC5

Anybody have any ideas how I can use the default email client to create and send a message without the user having to enter anything (I've been using ShellExecute with "mailto:" up until now). I've included mapi.h & linked mapi32 but keep getting an unresolved external error when compiling/linking.

Any ideas/alternatives appreciated.

RE: MAPISendMail with BC5

Try this ...

  MapiRecipDesc  dsc;
  TMapiMessage   MapiMessage;
  Cardinal MError;

    dsc.ulRecipClass = MAPI_TO;
    dsc.lpszName     = " ";
    dsc.lpszAddress  = 0;
    dsc.ulEIDSize    = 0;
    dsc.lpEntryID    = NULL;
    MapiMessage.ulReserved = 0L;
    MapiMessage.lpszSubject = "Your Subject ...";
    MapiMessage.lpszNoteText = "Your text ...;
    MapiMessage.lpszMessageType = NULL;
    MapiMessage.lpszDateReceived = NULL;
    MapiMessage.lpszConversationID = NULL;
    MapiMessage.flFlags = 0L;
    MapiMessage.lpOriginator = NULL;
    MapiMessage.nRecipCount = 1;
    MapiMessage.lpRecips = &dsc;
    MapiMessage.nFileCount = 0L;
    MapiMessage.lpFiles = NULL;
    MError=MapiSendMail(0L, reinterpret_cast<unsigned int>  (Application->Handle),
           MapiMessage, MAPI_DIALOG | MAPI_LOGON_UI | MAPI_NEW_SESSION , 0L);
    // --
  catch( Exception& E )
    your error stuff.

RE: MAPISendMail with BC5

Thanks for that. Unfortunately, I don't think I explained myself clearly enough in the first place (D'Oh).

I'm using Borland 5.5, not Builder, and MapiSendMail is the function that causes the problem (when linking).

I get the same problem when trying the same with MinGW.

I'm a little bit new to C/C++, so forgive me if there is areally obvious reason why I can't do this. I'm thinking that I might need a newer/different .def/.a as I can't find MapiSendMail in any of the ones I have.

Up until now I've been using:

             0, 0, SW_SHOWNORMAL);

It's a bit of a bodge though, and I can't see how to send attachments like this.
Any other means of sending email that uses the default client would be fine, it doesn't need to be MAPI.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close