Dette skulle være det du har brug for
Kyllekylle
******************************************
#include <stdio.h>
#import <cdo.dll>
using namespace MAPI;
void SendMail(char *email, char *subject, char *body)
{
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("CoInitialize Error\n");
return;
}
_SessionPtr pSession;
hr = pSession.CreateInstance("MAPI.Session");
if (FAILED(hr))
{
printf("CreateInstance Error\n");
return;
}
pSession->Logon();
FolderPtr pOutbox = pSession->Outbox;
MessagesPtr pMessages = pOutbox->Messages;
MessagePtr pMessage = pMessages->Add(subject);
pMessage->Text = (const char *)body;
RecipientsPtr pRecipients = pMessage->Recipients;
RecipientPtr pRecipient = pRecipients->Add (email);
pRecipient->Type = (long)CdoTo;
pRecipient->Resolve(true);
pMessage->Send(false);
pSession->Logoff();
}
void main(void)
{
SendMail("email@email.dk","Dette er en test","Yepper det virker");
}