View Poll Results: How can I write a code that sends email to notify someone

Voters
5. You may not vote on this poll
  • vb code

    2 40.00%
  • smiles

    3 60.00%
Results 1 to 4 of 4

Thread: Sending Email Notification

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    29

    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.

  2. #2
    Check out this tutorial on making a POP3 client: http://vbsquare.com/internet/pop/

  3. #3
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    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:
    1. Private Sub Command1_Click()
    2. Const SESSION_SIGNON = 1
    3. Const MESSAGE_COMPOSE = 6
    4. Const ATTACHTYPE_DATA = 0
    5. Const RECIPTYPE_TO = 1
    6. Const RECIPTYPE_CC = 2
    7. Const MESSAGE_RESOLVENAME = 13
    8. Const MESSAGE_SEND = 3
    9. Const SESSION_SIGNOFF = 2
    10.    
    11.     'Open up a MAPI session:
    12.     MAPISession1.Action = SESSION_SIGNON
    13.  
    14.     'Point the MAPI messages control to the open MAPI session:
    15.     MAPIMessages1.SessionID = MAPISession1.SessionID
    16.    
    17.     MAPIMessages1.Action = MESSAGE_COMPOSE 'Start a new message
    18.    
    19.     'Set the subject of the message:
    20.     MAPIMessages1.MsgSubject = "This is the subject."
    21.  
    22.     'Set the message content:
    23.     MAPIMessages1.MsgNoteText = "This is the mail message."
    24.    
    25.     'Set the recipients - repeat for each, just INC RecipIndex
    26.     MAPIMessages1.RecipIndex = 0 'First recipient
    27.     MAPIMessages1.RecipType = RECIPTYPE_TO 'Recipient in TO line
    28.     MAPIMessages1.RecipDisplayName = "[email protected]"  'e-mail name
    29.  
    30.     'MESSAGE_RESOLVENAME checks to ensure the recipient is valid and puts
    31.     'the recipient address in MapiMessages1.RecipAddress
    32.     'If the E-Mail name is not valid, a trappable error will occur.
    33.     MAPIMessages1.Action = MESSAGE_RESOLVENAME
    34.  
    35.     'Send the message:
    36.     MAPIMessages1.Action = MESSAGE_SEND
    37.    
    38.     'Close MAPI mail session:
    39.     MAPISession1.Action = SESSION_SIGNOFF
    40.    
    41.     Unload Me
    42.  
    43. End Sub

  4. #4
    Addicted Member
    Join Date
    Apr 2001
    Posts
    205
    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
  •  



Click Here to Expand Forum to Full Width