Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mailto that sends automatically

Status
Not open for further replies.
Jul 22, 2002
25
US
Inside VB6, I have normal code that will open the default mail client (Outlook Express in this case), and supply the Subject, To, and Body automatically.

Now how do I have this thing press the Send key and close the mail client?

Any help is appreciated,

Mr. Pickles
 
I guess you have it set up a bit like this:
Code:
With objMail
    .To = "me@tek-tips.com"
    .Subject = "My Subject"
    .Body = "My Body"
End With
[code]
To automatically send the email you can simply add a .Send command after you have set up all of the attributes of the email.

For more examples check out faq222-179 and also faq222-3395 if you get any security warnings.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ([URL unfurl="true"]http://www.tek-tips.com/search.cfm)[/URL] or read FAQ222-2244 on how to get better results.
 
Thanks for the info. I'll give it a try tonight. I didn't use the objMail method, as I didn't know what Outlook Express was/is called. I saw a routine for Outlook, and wondered if Outlook Express followed the same mentality, but I never tried because of the naming question...

Mr. Pickles
 
If you're creating the e-mail with a mailto string then the only way to send it is to use SendKeys to send the necessary key strokes to the Outlook Express menu.

Outlook Express doesn't have a programmable interface and any code you've seen for Outlook doesn't apply.

Paul Bent
Northwind IT Systems
 
I didn't think that OE had a programmable interface. But, based on the first answer, I figured it was worth a look. Anyway, assuming I grab hold of it, I'm now wondering what SendKeys to send? I assume it would be a "Alt-S", since that is the quickie command to send the email...?

Mr. Pickles
 
You can use the MapiSession and MapiMessage controls with any Mapi client;

MAPISession1.LogonUI = True
MAPISession1.SignOn
mapMess.SessionID = MAPISession1.SessionID
mapMess.Compose
mapMess.MsgNoteText = "hi"
mapMess.RecipDisplayName = "fred"
'mapMess.RecipAddress = "fred@aol.com"
mapMess.ResolveName
mapMess.MsgSubject = " T E S T M E S S A G E "
mapMess.AttachmentPathName = "c:\fred.txt"
mapMess.AttachmentName = "my fred"
mapMess.Send False

You can use the 'friendly name' as RecipDisplayName (as above) if you have it, otherwise Rem out that line and use the RecipAddress (as shown remmed above)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top