View Poll Results: How can I write a code that sends email to notify someone
- Voters
- 5. You may not vote on this poll
-
Oct 14th, 2001, 08:20 AM
#1
Thread Starter
Junior Member
Sending Email Notification
How can I write a code to notify someone through email that an error has occured in the program
Last edited by chukwe; Oct 14th, 2001 at 08:26 AM.
-
Oct 14th, 2001, 09:13 AM
#2
Member
Check out this tutorial on making a POP3 client: http://vbsquare.com/internet/pop/
-
Oct 14th, 2001, 09:31 AM
#3
Fanatic Member
Ewwwww.....Farsi-Burt......that's way too much to send a simple mail in the event of program error.
Just plop the 2 MAPI controls on your form. The following will send mail thru whatever legitimate mail application they have on their system.(I don't consider AOL legitimate <g>)
VB Code:
Private Sub Command1_Click()
Const SESSION_SIGNON = 1
Const MESSAGE_COMPOSE = 6
Const ATTACHTYPE_DATA = 0
Const RECIPTYPE_TO = 1
Const RECIPTYPE_CC = 2
Const MESSAGE_RESOLVENAME = 13
Const MESSAGE_SEND = 3
Const SESSION_SIGNOFF = 2
'Open up a MAPI session:
MAPISession1.Action = SESSION_SIGNON
'Point the MAPI messages control to the open MAPI session:
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Action = MESSAGE_COMPOSE 'Start a new message
'Set the subject of the message:
MAPIMessages1.MsgSubject = "This is the subject."
'Set the message content:
MAPIMessages1.MsgNoteText = "This is the mail message."
'Set the recipients - repeat for each, just INC RecipIndex
MAPIMessages1.RecipIndex = 0 'First recipient
MAPIMessages1.RecipType = RECIPTYPE_TO 'Recipient in TO line
'MESSAGE_RESOLVENAME checks to ensure the recipient is valid and puts
'the recipient address in MapiMessages1.RecipAddress
'If the E-Mail name is not valid, a trappable error will occur.
MAPIMessages1.Action = MESSAGE_RESOLVENAME
'Send the message:
MAPIMessages1.Action = MESSAGE_SEND
'Close MAPI mail session:
MAPISession1.Action = SESSION_SIGNOFF
Unload Me
End Sub
-
Nov 7th, 2001, 02:29 PM
#4
Addicted Member
What if you want the email to go to a recipient that is not in the address book?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|