Visual Basic 6 Black Book:Visual Basic And The Internet: Web Browsing, Email, HTTP, FTP, And DHTML
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Table 21.1 MAPIMessages control email methods.
Function
Method
Get email from Inbox
Fetch
Send email with Compose box
Send
Send email
Send
Save a message
Save
Copy a message for reply
Copy
Compose email
Compose
Reply to a message
Reply
Reply to all messages
ReplyAll
Forward a message
Forward
Delete a message
Delete
Show address book
Show
Show message details
Show
Resolve recipient name
ResolveName
Delete recipient
Delete
Delete attachment
Delete
Table 21.2 MAPIMessages control properties.
Property
Description
Action
Obsolete. Performs actions now performed by methods.
AddressCaption
Sets caption of the address book.
AddressEditFieldCount
Sets which address book edit controls to display.
AddressLabel
Sets appearance of To edit control in address book.
AddressModifiable
Sets whether address book can be modified by user.
AttachmentCount
Gets total number of attachments for current message.
AttachmentIndex
Sets currently indexed attachment.
AttachmentName
Sets name of the currently indexed attachment.
AttachmentPathName
Sets full path name of the currently indexed attachment.
AttachmentPosition
Sets position of indexed attachment in the message body.
AttachmentType
Sets type of currently indexed attachment.
FetchSorted
Sets message order when creating message set.
MsgConversationID
Sets the conversation thread identification value.
MsgCount
Gets the total number of messages in message set.
MsgDateReceived
Gets date on which current indexed message was received.
MsgID
Gets string identifier of current message.
MsgIndex
Sets index number of current message.
MsgNoteText
Text of current message.
MsgOrigAddress
Gets email address of originator of current message.
MsgOrigDisplayName
Gets originators name for current message.
MsgRead
True or False depending on whether message has been read.
MsgReceiptRequested
Indicates if return receipt is requested for message.
MsgSent
Indicates if message has been sent to mail server.
MsgSubject
Messages subject.
MsgType
Sets type of current message.
Sending Email From Visual Basic
Now that youve added the MAPISession and MAPIMessages control to your program (see the previous topic), how do you use them to send email? Lets see an example. Create a new standard EXE project, and add the MAPISession and MAPIMessages controls MAPISession1 and MAPIMessages1. Next add two command buttons, Command1 and Command2, with the captions Send email and Read email. Well enable Command1, the Send Email button, in this topic, and Command2, the Read Email button, in the next topic. In addition, well need some place to display the email weve read, so add a text box, Text1, to the form, setting its MultiLine property to True and its ScrollBars property to Both (3).
When users click Command1, they want to send email, and we let them do so by using the MAPIMessages controls Compose and Send methods. Our first task, however, is to start a new MAPI session, and we do that with the MAPISession controls SignOn method, after indicating that we dont want to download email by setting its DownLoadMail property to False:
Private Sub Command1_Click()
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
...
After signing on to the Microsoft Exchange email system, we set the MAPIMessages controls SessionID to the MAPISession controls SessionID property to initialize MAPIMessages1:
Private Sub Command1_Click()
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
...
To compose a new email message, we have to set the MAPIMessages1 controls MsgIndex property to -1 and call its Compose method:
Private Sub Command1_Click()
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
...
This code displays the Compose dialog box, as shown in Figure 21.12. Users can enter the email text and address they want to use in that dialog box and click the Send button (the Send button displays an envelope in Figure 21.12) to send their email.
Figure 21.12 Composing an email message.
When the user is done composing the email, we send it with the MAPIMessages1 controls Send method and sign off the MAPI session using the MAPISession1 controls SignOff method:
Private Sub Command1_Click()
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.Send True
MAPISession1.SignOff
End Sub
Thats itweve sent our email. What actually happens is that the program sends the new email message to the users Outbox (which is also opened when you open the Inbox), and the Outbox is usually set to send email automatically. In fact, thats the way the Microsoft Exchange usually works: by logging into the mail server youve specified at regular intervals. When it logs in, it sends the mail waiting in the Outbox and reads any waiting email, placing it in the Inbox. (In fact, now that weve sent email, well see how to read that email in the next topic.)
The code for this example, email.frm version 1 (version 2, which is located on this books accompanying CD-ROM, will let the user read email as well), appears in Listing 21.3.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
demo cgi 719create integration workspace tm?723B43723 727723 (2)Nuestro Circulo 719 ESTUDIOS FANTÁSTCOS 28 de mayo de 2016drzwi czech e60 EASY 719 DC RCmbdch20 723723,21,artykulusher x 719719 722719 722717 719więcej podobnych podstron