_Application olApp;
_Items olItem;
_ContactItem olConItem;
MAPIFolder olContactFolder;
COleException e;
if(!olApp.CreateDispatch("Outlook.Application", &e)) 
{
CString str;
str.Format("CreateDispatch() failed w/error 0x%08lx", e.m_sc);
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
    // Logon. Doesn't hurt if you are already running and logged on...
    _NameSpace olNs(olApp.GetNamespace("MAPI"));
    COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
    olNs.Logon(covOptional, covOptional, covOptional, covOptional);
    // Get Default Contact Folder information...
const long olFolderOutbox = 4;
olContactFolder=olNs.GetDefaultFolder(olFolderOutbox);
for(int i=0;i<m_arriid.GetSize();i++)
{
_MailItem olMail(olApp.CreateItem(0));
m_sendmail.ReadCurMail(m_arriid.GetAt(i));
olMail.SetTo(m_sendmail.m_MailTo);
olMail.SetBcc(m_sendmail.m_Cc);
olMail.SetSubject(m_sendmail.m_Subject);
olMail.SetBody(m_sendmail.m_Content);
// Save the message!
Attachments olAttachs;
olAttachs=olMail.GetAttachments();
Attachment olAttach;
olAttach.AttachDispatch(olAttachs,true);
// COleVariant(
CString temp=m_sendmail.m_Attach;
int iStart=0;
int iEnd=temp.GetLength();
// 分解
for(;;)
{
int j=temp.Find(";",iStart);
if(j==-1) break;
// 是否存在
CFile file;
int ret=file.Open(temp.Mid(iStart,j),CFile::modeRead);
if(ret!=0)
{
file.Close();/* olAttachs.Add(COleVariant(temp.Mid(iStart,j)), 
COleVariant((long)1),COleVariant((long)(15000)), 
COleVariant(temp.Mid(iStart,j)));*/
}
iStart=j+1;
} olMail.Save();
}
olNs.Logoff(); 
我的代码,能带一个