*sigh* i give up, plz help.., how do I send email in VC++?...,
i''ve searched in google, in msdn, in my local msdn, the forums here and i''ve almost solved my problem using MAPI(well, i think this is the api that you''ll use).., but at the end,
after using the MAPISendMail(...) i got this error which i don''t have any idea to solve it,
error LNK2019: unresolved external symbol _MAPISendMail@20 referenced in function _WinMain@16
anyway, what i wanna do is, a messabebox pops up, and ask the user if he wants to send this _____ and if the user clicks on yes, his default email client, ie outlook or whatever he has, will popup, and with my email address right into the To: box,
i''ve encounted also about the outlook object model, something about automation stuffs, and using the winsock but i really don''t have any ideas about these, actually, am not really sure if MAPI does the job i wanted,
so.., plz help!
many thanks,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
I think a call to shellexecute should do the trick:
ShellExecute(your_hwnd, "open","mailto:youremail@yourprovider.com", NULL, NULL, SW_SHOWNORMAL);
its just like an HTML reference to "mailto":
<a href="mailto:youremail@yourprovider.com">email me</a>
but used inside a program.
ShellExecute(your_hwnd, "open","mailto:youremail@yourprovider.com", NULL, NULL, SW_SHOWNORMAL);
its just like an HTML reference to "mailto":
<a href="mailto:youremail@yourprovider.com">email me</a>
but used inside a program.
June 05, 2002 10:50 AM
your error means you probably didnt link the library you are using to the project.
Use this command anywhere in the code.
#pragma comment(lib, "*.lib"
replace * with the name of the library. MAPI or whatever.
Use this command anywhere in the code.
#pragma comment(lib, "*.lib"
replace * with the name of the library. MAPI or whatever.
Just tested it, and it works, here is the simple sample console code:
Note that you can also put a "visit my webpage" button using this function, just change it to:
ShellExecute(NULL, "open","http://www.yourwebsite.com", NULL, NULL, SW_SHOWNORMAL);
#include <windows.h>int main(){ ShellExecute(NULL, "open","mailto:youremail@yourprovider.com", NULL, NULL, SW_SHOWNORMAL); return 0;}
Note that you can also put a "visit my webpage" button using this function, just change it to:
ShellExecute(NULL, "open","http://www.yourwebsite.com", NULL, NULL, SW_SHOWNORMAL);
kwitz: ei, the ShellExcecute is kewl, it''s nice to know about that function, anyway, i need an api that will allow me to attach automatically the file on the email(so that i don''t need to let the user do anything),
ap, actually that''s my problem, i do not know what to include! i''ve search msdn but they didn''t specfied the right .lib, they just said what header to include, so this is what i did,
#pragma comment(lib, "mapi.lib")
#pragma comment(lib, "mapi32.lib")
#pragma comment(lib, "nmapi.lib")
which still gives me the same error...,
also, is this the api to use? MAPI?
ap, actually that''s my problem, i do not know what to include! i''ve search msdn but they didn''t specfied the right .lib, they just said what header to include, so this is what i did,
#pragma comment(lib, "mapi.lib")
#pragma comment(lib, "mapi32.lib")
#pragma comment(lib, "nmapi.lib")
which still gives me the same error...,
also, is this the api to use? MAPI?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Well you can always do it manually, which I find less anoying than learning to use MAPI
you would have to research on socket programming and the smtp protocol, maybe MIME 64 encoding too.
I have done this for sending email, but never tryed to atach files.
anyway here is rfc 821 on SMTP. its not hard at all, the hard part I think would be guessing the users SMTP server address.
Sorry, I would help you with MAPI, but I know nothing about that API.
you would have to research on socket programming and the smtp protocol, maybe MIME 64 encoding too.
I have done this for sending email, but never tryed to atach files.
anyway here is rfc 821 on SMTP. its not hard at all, the hard part I think would be guessing the users SMTP server address.
Sorry, I would help you with MAPI, but I know nothing about that API.
smtp and winsock? but winsock are just for sendind messages(not email per se)right? and smtp will it open the default email's client?
i've also encoundered Collaboration Data Objects (CDO), which gives additional functionality for MAPI, any idea about this, i've seen the example in the sdk, but everything is in VB ?
yikes!
[edited by - mickey on June 5, 2002 11:55:22 PM]
i've also encoundered Collaboration Data Objects (CDO), which gives additional functionality for MAPI, any idea about this, i've seen the example in the sdk, but everything is in VB ?
yikes!
[edited by - mickey on June 5, 2002 11:55:22 PM]
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
hi, any more nice advice? activating the client''s email program, as well as sending an email thru your vc++ app?
thanks,
thanks,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
winsock an api used to transmit packets across a network. smtp is the simple mail transfer protocal, and used by email clients to send emails. thats all you need to send emails. you dont need to activate the email client. you connect the server specified after the @ and then do as the smtp protocal says (ussually works). after that you close the connection. many isps offer a smtp server for you to cpnnect to, which will handle resnding the message, queueing and generally helps ensure better more reliable transfer. this though can be specified in the config (anyone using an email client should be able to look this information up, though i am sure you could figure it out through some function calls or reading a register key).
there is plenty of information about this on the net. do some research and expiermentation. i suggest getting a mail server for yourself to test on, instead of sending emails through the net since too many malformed (ie bad) requests could land you on a blacklist (i blocked from sending mail to that server). plus some isps will notice the increase in mail usage and think you may be sending spam, even if its to yourself.
though the ShellExecute() method posted previously is pretty much what you want.
[edited by - a person on June 9, 2002 3:59:50 AM]
there is plenty of information about this on the net. do some research and expiermentation. i suggest getting a mail server for yourself to test on, instead of sending emails through the net since too many malformed (ie bad) requests could land you on a blacklist (i blocked from sending mail to that server). plus some isps will notice the increase in mail usage and think you may be sending spam, even if its to yourself.
though the ShellExecute() method posted previously is pretty much what you want.
[edited by - a person on June 9, 2002 3:59:50 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement