Click here to Skip to main content
15,898,670 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Splitter windows w/o Doc/View Pin
Nish Nishant31-Oct-01 13:33
sitebuilderNish Nishant31-Oct-01 13:33 
GeneralRe: Splitter windows w/o Doc/View Pin
bumby1-Nov-01 4:12
bumby1-Nov-01 4:12 
GeneralC++ Language Problem! Pin
Joel Holdsworth31-Oct-01 10:57
Joel Holdsworth31-Oct-01 10:57 
GeneralRe: C++ Language Problem! Pin
Alvaro Mendez31-Oct-01 11:59
Alvaro Mendez31-Oct-01 11:59 
GeneralRe: C++ Language Problem! Pin
Todd Smith31-Oct-01 17:03
Todd Smith31-Oct-01 17:03 
QuestionHow can you see who called OnToolTipNeedText()? Pin
Craig Miller31-Oct-01 10:24
Craig Miller31-Oct-01 10:24 
GeneralLinking Input to an email output Pin
B-Rock31-Oct-01 9:46
B-Rock31-Oct-01 9:46 
GeneralRe: Linking Input to an email output Pin
Alex Griffing31-Oct-01 11:53
Alex Griffing31-Oct-01 11:53 
I'm getting very frustrated with trying to send email from my computer programmatically. From what I've been able to find out, there are two choices:

- use MAPI:
problem: It pops up dialog boxes requiring user input when it is unable to send messages or when various errors happen. Therefore it is not useful to me since I want to run the program on a computer that isn't being looked at by a human.

- use SMTP:
problem: You need a computer that you can connect to on port 25 and say HELO\r\nMail From: a@b.c\r\nRCPT To: x@y.z\r\ndata\r\nfirstline\r\nlastline\r\n.\r\nQUIT\r\n or whatever. In any case I don't have a computer that I can send this through so I can't do this either.

But check out the code below for an example of doing MAPI. You have to put a line of code each of mapi init and uninit and include mapi.h. The functions i call at the end here just display the appropriate error message according to a switch statement using strings taken from the msdn docs. hope it helps.

/*
CMfcserverDlg::Mail(CString subject, CString text) {
LPMAPISENDMAIL lpfnMAPISendMail = (LPMAPISENDMAIL) GetProcAddress (m_mapiModule,"MAPISendMail");
LPMAPILOGON lpfnMAPILogon = (LPMAPILOGON) GetProcAddress (m_mapiModule,"MAPILogon");
LPMAPILOGOFF lpfnMAPILogoff = (LPMAPILOGOFF) GetProcAddress (m_mapiModule,"MAPILogoff");
LHANDLE lhSession = 0;
char subject[] = "this is the subject";
char message_text[] = "automated\r\nhello\r\nthis is the message text\r\nblah\r\nblah\r\nblah\r\ngoodbye";
char str_originator_name[] = "alexander the originator";
char str_recip_name[] = "alexander the recipient";
char str_originator_address[] = "snowman@north.pole";
char str_recip_address[] = "SMTP:agriffing@hotmail.com";
MapiRecipDesc originator;
originator.ulReserved = 0;
originator.ulRecipClass = MAPI_ORIG;
originator.lpszName = str_originator_name;
originator.lpszAddress = str_originator_address;
originator.ulEIDSize = 0;
originator.lpEntryID = 0;
MapiRecipDesc recip;
recip.ulReserved = 0;
recip.ulRecipClass = MAPI_TO;
recip.lpszName = str_recip_name;
recip.lpszAddress = str_recip_address;
recip.ulEIDSize = 0;
recip.lpEntryID = 0;
MapiMessage msg;
msg.ulReserved = 0;
msg.lpszSubject = subject;
msg.lpszNoteText = message_text;
msg.lpszDateReceived = 0;
msg.lpszConversationID = 0;
msg.flFlags = 0;
msg.lpOriginator = &originator;
msg.nRecipCount = 1;
msg.lpRecips = &recip;
msg.nFileCount = 0;
msg.lpFiles = 0;
ULONG ret;
ret = lpfnMAPILogon(0, 0, 0, 0, 0, &lhSession);
if (ret != SUCCESS_SUCCESS) {
HandleMAPILogonError(ret);
} else {
ret = lpfnMAPISendMail(lhSession, 0, &msg, 0, 0);
if (ret != SUCCESS_SUCCESS) {
HandleMAPIError(ret);
}
}
lpfnMAPILogoff(lhSession, 0, 0, 0);
}
*/
GeneralRe: Linking Input to an email output Pin
Nish Nishant31-Oct-01 13:25
sitebuilderNish Nishant31-Oct-01 13:25 
GeneralDownload/upload progress control Pin
Ashman31-Oct-01 9:19
Ashman31-Oct-01 9:19 
GeneralRe: Download/upload progress control Pin
Nish Nishant31-Oct-01 13:22
sitebuilderNish Nishant31-Oct-01 13:22 
GeneralRe: Download/upload progress control Pin
Nish Nishant31-Oct-01 13:23
sitebuilderNish Nishant31-Oct-01 13:23 
QuestionHow do I right align text in a pane? Pin
Andrew Stampor31-Oct-01 9:18
Andrew Stampor31-Oct-01 9:18 
Generalcommon open dialog size problem Pin
31-Oct-01 9:15
suss31-Oct-01 9:15 
QuestionListview and combobox questions? Margin in a combobox? Pin
mhowes31-Oct-01 8:13
mhowes31-Oct-01 8:13 
GeneralVB Active X Dll Pin
ahartoch31-Oct-01 6:50
ahartoch31-Oct-01 6:50 
GeneralRe: VB Active X Dll Pin
Michael P Butler31-Oct-01 6:55
Michael P Butler31-Oct-01 6:55 
GeneralRe: VB Active X Dll Pin
Carlos Antollini31-Oct-01 7:17
Carlos Antollini31-Oct-01 7:17 
GeneralPreventing MDI Child Wnd Resizing Pin
Chambers31-Oct-01 6:49
Chambers31-Oct-01 6:49 
GeneralRe: Preventing MDI Child Wnd Resizing Pin
Steen Krogsgaard1-Nov-01 1:35
Steen Krogsgaard1-Nov-01 1:35 
GeneralRe: Preventing MDI Child Wnd Resizing Pin
Chambers1-Nov-01 2:15
Chambers1-Nov-01 2:15 
GeneralRe: Preventing MDI Child Wnd Resizing Pin
Steen Krogsgaard1-Nov-01 2:47
Steen Krogsgaard1-Nov-01 2:47 
GeneralSending string between two apps Pin
31-Oct-01 6:08
suss31-Oct-01 6:08 
GeneralRe: Sending string between two apps Pin
#realJSOP31-Oct-01 6:12
professional#realJSOP31-Oct-01 6:12 
GeneralRe: Sending string between two apps Pin
31-Oct-01 6:26
suss31-Oct-01 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.