|
-
November 5th, 2001, 02:20 AM
#1
URGENT ..Mailing using ShellExecute
hai all
i want to use ShellExecute to invoke the default mail program
and add subject ,body and an attachment
then what should be the command line
i tried with this
mailto:[email protected]?subject=test subject&body=test body&attachment="c:\attach.txt"
but the attachment does not work
thnks
akg
-
November 5th, 2001, 06:26 AM
#2
Re: URGENT ..Mailing using ShellExecute
no one there 
-
November 5th, 2001, 08:57 PM
#3
Re: URGENT ..Mailing using ShellExecute
Try:
ShellExecute(NULL,"open","MailTo:[email protected]?subject=your subject&body=your body&attachment=\"c:\\attach.txt\"",NULL,NULL,SW_SHOWNORMAL);
[i]Rate it if it helps
-
November 5th, 2001, 11:54 PM
#4
Re: URGENT ..Mailing using ShellExecute
thanks for the replay
this did't work.. the attachment was not there
i want that thing
-
November 6th, 2001, 12:13 AM
#5
Re: URGENT ..Mailing using ShellExecute
Does this attachment file exist in your disk?
It works fine in my machine, I use VC 6.0 and outlook.
[i]Rate it if it helps
-
November 6th, 2001, 02:45 AM
#6
Re: URGENT ..Mailing using ShellExecute
Thanks 4 the replay
yes the file was present...
i'am working in 2k/vc6.0 ,but the code didn't work..
thanks akg
-
November 6th, 2001, 09:57 AM
#7
Re: URGENT ..Mailing using ShellExecute
i have tested it!
i have no attachment too!
vc6.0+outlook express
-
November 7th, 2001, 03:15 AM
#8
Re: URGENT ..Mailing using ShellExecute
Why does it some times work and other times it does not ??
-
November 9th, 2001, 07:33 PM
#9
Re: URGENT ..Mailing using ShellExecute
Outlook Express does not allow you to add an attachment via ShellExecute().
Try using MAPI. It is simple and works very well.
Here is an example that fires off an email with attachment. Note that as written, it requires NO input from user.
#include <mapi.h>
void CMyApp::OnMySendMail()
{
HMODULE hLib=::LoadLibrary("MAPI32.DLL");
if (hLib == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_MAPI_LOAD);
return;
}
ULONG (PASCAL *lpfnSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);
(FARPROC&)lpfnSendMail = GetProcAddress(hLib, "MAPISendMail");
if (lpfnSendMail == NULL)
{
AfxMessageBox(AFX_IDP_INVALID_MAPI_DLL);
return;
}
// prepare the file description (for the attachment)
MapiFileDesc fileDesc;
memset(&fileDesc, 0, sizeof(fileDesc));
fileDesc.nPosition = (ULONG)-1;
fileDesc.lpszPathName = "c:\\netlog.txt";
// prepare the recipient description.
MapiRecipDesc recip;
memset(&recip, 0, sizeof(recip));
recip.ulRecipClass = MAPI_TO;
recip.lpszAddress = "[email protected]";
// prepare the message (empty with 1 attachment)
MapiMessage message;
memset(&message, 0, sizeof(message));
message.lpszSubject = "This is a TEST!!!";
message.lpszNoteText = " Dave Paxton\n 1-234-567-8901\n [email protected]";
// Recipients.
message.nRecipCount = 1;
message.lpRecips = &recip;
// Attachments.
message.nFileCount = 1;
message.lpFiles = &fileDesc;
int nError = lpfnSendMail(0, 0, &message, 0, 0);
::FreeLibrary(hLib);
ASSERT(nError == SUCCESS_SUCCESS);
}
Forgive the formatting, even with the formating markup, it got ruined.
Geno
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|