Linked Questions

Popular Questions

I have an application that compiled and linked in C++ Builder 2009 but when trying to upgrade it to XE3 it gives an error:

[ilink32 Error] Error: Unresolved external '__fastcall Winapi::Mapi::MapiLogOn(unsigned int, char *, char *, unsigned int, unsigned int, unsigned long *)' referenced from filename.OBJ

I have a header file Email.h that is included in the main form frmMain and a method in the main form that can be called from with it (see code examples below). This method SendMail, then prepares and sends the e-mail message.

I am trying to understand why I am getting this error from the Linker.

Can someone please assist me?

I have tried to put all the relevant code into the main form, to eliminate the header Email.h, however this made no difference I still get the same error.

I am missing something that I hope is obvious to someone.


#include <mapi.hpp>

bool SendEmail(const char * const RecipientName,
           const char * const EmailAddress,
           const char * const Subject, const char * const MessageText)
unsigned int error;

try {
    unsigned int Session;
    error = MapiLogOn( 0,
                   MAPI_NEW_SESSION | MAPI_LOGON_UI,
                   &Session );
    if (error != SUCCESS_SUCCESS) {
      return false;
 // rest of code truncated


 #include "Email.h" 

 //  Call to 'SendMail' method in frmMain.cpp
 //Show message to user to send e-mail
 if (MessageDlg("Do you want to send notification e-mail?",
      mtWarning, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes) {

 // SendMail method in frmMain.cpp
 void __fastcall TfrmMain::SendMail()
 // Send email method

 bool Success;

 // Used to assemble email message and send it. Needs MAPI installed i.e. 
 // Name, Address, Subject, Body
 String Name = cboAllocatedTo->Text;
 String Address = DLookUp("EmailAddress", "Employee",
        "ServiceNO = '" + cboAllocatedTo->KeyValue + "'", 
                    dmMain->cnnMain).operator AnsiString();
  String Subject = "New task added to your workload.";
  String Body = "Task " + dbeTaskName->Text + " has been added to your 

  Success = SendEmail(AnsiString(Name).c_str(),
  // Let user know that e-mail was not sent
  if (!Success) {
    MessageDlg("Warning - Email message was not sent to " + Name +
        "\n\nat e-mail address " + Address,
        mtWarning, TMsgDlgButtons() << mbOK, 0);

Related Questions