Ian Swift
May 11th, 1999, 12:57 PM
I was wondering how I would go about getting a VC++ application to send a file via email when I click a button.
Thanks
Thanks
|
Click to See Complete Forum and Search --> : Sending emails Ian Swift May 11th, 1999, 12:57 PM I was wondering how I would go about getting a VC++ application to send a file via email when I click a button. Thanks suganyas May 14th, 1999, 05:17 AM Hi! Here's one of the methods to send an e-mail through a VC program. U can add the code in the Button Clicked Event.Make use of the MAPI32 Dll and header files mentioned below for the same. Refer online help for more info. #include <windows.h> #include <mapi.h> LPMAPILOGON lpfnMAPILogon; LPMAPISENDMAIL lpfnMAPISendMail; LPMAPILOGOFF lpfnMAPILogoff; MapiRecipDesc recipient ={0, MAPI_TO,"Suganya Swaminathan", "SMTP:suganyas@aditi.com", 0, NULL}; MapiMessage message ={0, "Greetings", "Hello, Ms.Sukanya!\n",NULL, NULL, NULL, 0, NULL, 1, &recipient, 0, NULL}; LHANDLE lhSession; HANDLE hMAPILib; hMAPILib = LoadLibrary("MAPI32.DLL"); lpfnMAPILogon =(LPMAPILOGON)GetProcAddress(hMAPILib, "MAPILogon"); lpfnMAPISendMail =(LPMAPISENDMAIL)GetProcAddress(hMAPILib, "MAPISendMail"); lpfnMAPILogoff =(LPMAPILOGOFF)GetProcAddress(hMAPILib, "MAPILogoff"); (*lpfnMAPILogon)(0, NULL, NULL, MAPI_NEW_SESSION , 0,&lhSession); (*lpfnMAPISendMail)(lhSession, 0, &message, 0, 0); (*lpfnMAPILogoff)(lhSession, 0, 0, 0); AfxMessageBox("Message to the Suganya sent.\n"); FreeLibrary(hMAPILib); Do let me know if this works. Regards, Sukanya Swaminathan Software Engineer Aditi Technologies Pvt. Ltd. Blore - 80 Web Page : www.aditi.com May 18th, 1999, 03:02 PM I tried your program, I am not getting any errors or warnings (except: HMODULE instead of HANDLE for hMAPILib ), but it's not working. When I tried to with HANDLE, I got an error of conversion from void* to HINSTANCE* not possible. So, I made that to HMODULE, then I am not getting any errors but it's not working also. let me any wrong...if it has codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |