C++ code for the VBA I posted - note that it's pretty much a direct translation...
#import "progid:Outlook.Application" auto_search
int main(int, char**)
{
try
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
Outlook::_ApplicationPtr ol(__uuidof(Outlook::Application));
Outlook::_MailItemPtr msg(ol->CreateItem(Outlook::olMailItem));
msg->Subject = "_this is my subject_";
msg->Attachments->Add("_path to the attachment_");
// If execution gets here, the attachment's been added to msg, and you can go on and do other stuff!
msg->Body = "_my message_";
msg->Recipients->Add("_an e-mail address_");
msg->Send();
}
catch (_com_error& e)
{
std::cerr << (char*)e.Description() << std::endl;
}
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p