In your code, you are only adding the file names to a list box. Since you don't show where you are sending the email, we can't really tell what is missing.
I found 2 links that might help on sending attachments using MFC:
http://support.microsoft.com/kb/200174[
^]
http://www.example-code.com/mfc/smtp_sendEmailWithAttach.asp[
^]
Also, when you are using
OFN_ALLOWMULTISELECT
, you must ensure that the buffer is large enough to contain all the file names:
CFileDialog dialog(TRUE,_szFilter,NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST);
TCHAR buffer[5000];
dialog.m_ofn.lpstrFile = buffer;
dialog.m_ofn.nMaxFile = sizeof(buffer) / sizeof(TCHAR);
if (dialog.DoModal() == IDOK)
{
...
}