ShellExecute (GetSafeHwnd(), "open", "mailto:harold-...@juno.com",
NULL, NULL, SW_SHOWNORMAL);
but can someone tell me how to attach the current file from the open
document? I'm currently using a CTreeView document, but all I want to
forward is the open document on disk (not the tree). I know how to
retrieve the document filename but attaching a copy of that document
to the email is beyond my current abilities.
Thanks in advance
Harold DeWayne
You can use the following functions to send eMail and file
attachments in concert with a MAPI enabled mail client:
MAPILogon()
MAPISendMail()
MAPISendDocuments()
MAPIReadMail()
MAPIDeleteMail()
MAPISaveMail()
MAPILogoff()
Additionally, you can send eMail by using the SMTP protocol, the
exact name for this technology is "Simple Mail Transfer Protocol",
the SMTP server enables you to send eMail directly from your machine
withOut using your internet service provider's server machine.
Hope these information helps,
Kellie.
ULONG uRetCode = 0;
LPMAPISENDMAIL lpMAPISendMail = NULL;
HMODULE hLibMAPI = NULL;
MapiRecipDesc ReceiverInfo = {0, MAPI_TO, "", pszRecvAddress,
0, 0};
MapiFileDesc AttachmentInfo = {0, 0, 0xFFFFFFFF, pszFileName,
"", NULL};
MapiMessage MailInfo =
{
0,
pszTitle,
pszNotes,
NULL,
NULL,
NULL,
MAPI_SENT,
NULL,
1,
&ReceiverInfo,
1,
&AttachmentInfo
};
hLibMAPI = ::LoadLibrary("MAPI32.DLL");
if (NULL == hLibMAPI)
{
printf("ERROR on Load MAPI32.DLL file!!! Cancel to auto send
mail!!!\n");
return;
}
lpMAPISendMail = (LPMAPISENDMAIL)::GetProcAddress(hLibMAPI,
"MAPISendMail");
if (NULL == lpMAPISendMail)
{
printf("ERROR on Get MAPISendMail Function Address!!! Cancel to
auto send mail!!!\n");
goto ERR_EXIT;
}
uRetCode = lpMAPISendMail(0L, 0L, &MailInfo, 0, 0);
if (SUCCESS_SUCCESS == uRetCode)
{
printf(
"Success to Send mail to: %s, Mail Title:%s, Mail
Notes:%s,Attachment file name:%s\n",
pszRecvAddress,
pszTitle,
pszNotes,
pszFileName
);
}
else
{
printf("ERROR:failed Send mail!\n");
}
ERR_EXIT:
if (NULL != hLibMAPI)
{
::FreeLibrary(hLibMAPI);
hLibMAPI = NULL;
}
return;
}