Solved

How can I send a mail modelessly?

Posted on 1998-09-23
14
305 Views
Last Modified: 2013-11-19
Our program gives user a way to send a mail message. Currently we use MAPISendMail function from MAPI32.DLL.
But in that way of sending mail I get a mail message window modal for my application, so can't do anything until I close the message window.
How can I send a mail modelessly, in the way Word does it?
0
Comment
Question by:Moshe072898
  • 5
  • 4
  • 4
  • +1
14 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1322499
Creating a separate thread might work.  Look into the function AfxBeginThread.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322500
I don't think they are using the simple MAPI functions in MS Word or ther other MS office apps.

There's a MAPI (without the word simple - and rightly so) which has a COM interface.  I think Word, Excel etc. use this.
0
 
LVL 1

Expert Comment

by:kumarana
ID: 1322501
I think a simpler method could be to use socket and
use port 25.
use the SMTP protocol and send the message.

If you want to send attacments then in www.codeguru.com
you find MFC code to send attachments through sockets.

That code is real cool and it can save you a lot of work.
all the best
0
 

Author Comment

by:Moshe072898
ID: 1322502
Thank  you , kumarana,
But I don't think the method you suggested suits me. I'd like to have all that UI that MAPI gives. I just wanted it to work modelessly.
I'll try a suggestion of thresher_shark.
I also think that Answer2000 is right and there is a MAPI with COM interface. If someone knows where is a sample of its using, please let me know.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322503
Docs in Platform SDK

MSDN:
Platform SDK, and DDK Documentation / Platform SDK / Database and Messaging Services / Win32 Messaging (MAPI)

It's actually "COM like" as it was devised before COM was complete, so it has a few funnies.  Samples like there.  Third party samples are thin on the ground.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322504
BTW a good work round with simple MAPI is to create a 2nd program with just the dialog (and say command line params), then

1. Prog A writes out file to send
2. Prog A runs Prog B
3. Prog B brings up send mail dlg
4. Prog A then continues happily on
0
 

Author Comment

by:Moshe072898
ID: 1322505
Excuse me, kumarana for rejecting your answer. See my previous comment for reasons.
Answers2000, don't you think that you last comment contains the same idea   thresher_shark proposed, but in more complicated form? I tried this (thread)  and it works good enough except  for "minimize" button that still does not work. But I suspect that there are some Microsoft implementation tricks. If someone knows how to work around this - please let me know.
I want to give points to  thresher_shark, I just don't know how to do it.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 8

Expert Comment

by:Answers2000
ID: 1322506
Well it's not exactly the same, because I just wanted to make clear you don't have to create a thread.

Thresher needs to look the question, then you can grade his answer to give him the pts
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322507
Well it's not exactly the same, because I just wanted to make clear you don't have to create a thread.

Thresher needs to lock the question, then you can grade his answer to give him the pts
0
 
LVL 6

Accepted Solution

by:
thresher_shark earned 50 total points
ID: 1322508
Thank you, Moshe, I didn't think that my comment would help you, but I guess it does.  Can you please elaborate on the minimize-button-not-working problem?  Perhaps we can help you with that too.
0
 

Author Comment

by:Moshe072898
ID: 1322509
Well, Thresher, points are yours.
What about minimize button,  it's that simple like it sounds - when you press it , it does nothing.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1322510
>> points are yours
Did you forget to grade me? :-)

About the minimize button... what about the other buttons in the corner, the maximize and the close button.  Do they work?  Also, is the minimize button enabled or disabled?
0
 

Author Comment

by:Moshe072898
ID: 1322511
Don't worry about the points - they are yours and only yours. But if I accept your answer - you won't be able to add comments.
If you have nothing to add - I accept your answer immediately.
As for the button - it is enabled, can be pressed, two others work perfectly.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1322512
Wow that is strange.  I do not know the answer.  Perhaps you could post another question in the MFC area and others who know more about MFC could help you (I am not a real expert on the subject, see profile) :-).  Good luck and thanks for the points.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
notReplace  challenge 53 102
substring method in java 1 79
conditional code and condition difference 9 65
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now