0

I am using EASendEmail with Visual C++. After I compile the code and run it, I get an error which reads: "Debug Error! /Program:[file path] /abort() has been called/ (press retry to debug the application)"

The code is from this website:https://www.emailarchitect.net/easendmail/kb/vc.aspx?cat=0

The error is occurring in the lins:

oSmtp->LicenseCode = _T("TryIt");

'

_tprintf(_T("Start to send email ...\r\n"));

I have tried debugging mode in visual studio and it lead me to an unhandled expression in an attached library and an error at a specific memory location.

c++

#include "pch.h"
#include "easendmailobj.tlh"
#include <tchar.h>
#include <iostream>
using namespace std;
using namespace EASendMailObjLib;
int _tmain(int argc, _TCHAR* argv[])
{

    ::CoInitialize(NULL);
    IMailPtr oSmtp = NULL;
    oSmtp.CreateInstance("EASendMailObj.Mail");//<- one cause of the error
    oSmtp->LicenseCode = _T("TryIt");
    //...
    _tprintf(_T("Start to send email ...\r\n"));//<- one cause of the error

the error:https://i.stack.imgur.com/SQDwr.jpg

  • Did `oSmtp.CreateInstance("EASendMailObj.Mail");` succeed? – Michael Chourdakis Jul 08 '19 at 15:33
  • The line ran without errors. – Cyrus Singer Jul 08 '19 at 15:44
  • `easendmailobj.tlh` is a `#import` generated comutil-wrapped type-library header of the EASendMail com library. It uses the comutil smart pointers and method/property wrappers. If the `CreateInstance` fails it is almost guaranteed the appropriate COM library is not installed properly, or is not available due to permission restrictions. The abort is likely happening when a `_com_error` exception is thrown. Wrap all code below the `CoInitialize` with a `try-catch`, where the catch is `_com_error const& ce`, and set a breakpoint in the catch handler to examine the exception. bet: class not found – WhozCraig Jul 08 '19 at 15:46
  • And unrelated: `IMailPtr oSmtp = NULL;`, the initialization to `NULL` is pointless. comutil smart pointers default to null until properly attached to a valid com interface from an appropriate com object. That can be done by method or even construction using the optional coclsid constructor ( `IMailPtr oSmtp(__uuidof(Mail));`, which would eliminate the need for `CreateInstance`, btw). – WhozCraig Jul 08 '19 at 15:52
  • error Descritpion: Trial Version Expired! ErrorInfo: 010EF100 Source: EASendMailObj.Mail.1 -- output from the catch – Cyrus Singer Jul 08 '19 at 16:04

0 Answers0