The HRESULT 0x8004020d appears in
http://support.microsoft.com/kb/963581[
^]
From
http://msdn.microsoft.com/en-us/library/ms870485(v=exchg.65).aspx[
^]
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import "c:\program files\common files\microsoft shared\cdo\cdoex.dll" no_namespace
main( ){
CoInitialize(NULL);
{
IMessagePtr IMsg(__uuidof(Message));
IConfigurationPtr iConfig = Msg->Configuration;
FieldsPtr Flds;
FieldPtr Fld;
Flds = iConfig->Fields;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/smtpserver")]->Value = _variant_t("fakesmtp.example.com") ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/smtpserverport")]->Value = _variant_t((long)25) ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/sendusing")]->Value = _variant_t((int)cdoSendUsingPort) ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/smtpaccountname")]->Value = _variant_t("My Name") ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")]->Value = _variant_t("\"MySelf\" <myself@example.com>") ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/senduserreplyemailaddress")]->Value = _variant_t("\"Another\" <another@example.com>") ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")]->Value = _variant_t((long)cdoBasic) ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/sendusername")]->Value = _variant_t("domain\\username") ;
Flds->Item[_variant_t("http://schemas.microsoft.com/cdo/configuration/sendpassword")]->Value = _variant_t("password") ;
Flds->Update();
iMsg->Configuration = iConfig;
iMsg->Send();
}
CoUninitialize();
}
I think you missed
cdoSendEmailAddress
, and put the sender's mail in
cdoSendUserName
. Of course, I cannot confirm or disprove this assumption without debugging the code in your machine... ;)
Hope this helps,
Pablo.