Results 1 to 5 of 5

Thread: Email

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    39

    Email

    Hi,

    I want to include a small email part to my application. Just so the user can send and recieve emails. Is there any already made VB programs that I can download and look at the code?


    Thanks,
    Matt

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Are you using Outlook?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    39
    Yes, I use Outlook.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    39
    Anyone?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    To Send Mail

    VB Code:
    1. Private Sub SendMailMessage(DisplayMsg As Boolean, Receiver As String, Optional  AttachmentPath)
    2.     Dim objOutlook As Outlook.Application
    3.     Dim objOutlookMsg As Outlook.MailItem
    4.     Dim objOutlookRecip As Outlook.Recipient
    5.     Dim objOutlookAttach As Outlook.Attachment
    6.     Dim CallDescription As String
    7.  
    8. ' Create the Outlook session.
    9.     Set objOutlook = CreateObject("Outlook.Application")
    10.  
    11. ' Create the message.
    12.     Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    13.  
    14.     With objOutlookMsg
    15. ' Add the To recipient(s) to the message.
    16.         Set objOutlookRecip = .Recipients.Add(Receiver)
    17.         objOutlookRecip.Type = olTo
    18.  
    19. ' Add the CC recipient(s) to the message.
    20.         Set objOutlookRecip = .Recipients.Add("an other person")
    21.         objOutlookRecip.Type = olCC
    22.  
    23. ' Add the BCC recipient(s) to the message.
    24.   Set objOutlookRecip = .Recipients.Add("[email protected]")
    25.   objOutlookRecip.Type = olBCC
    26.  
    27. ' Set the Subject, Body, and Importance of the message.
    28.         .Subject = "Replace this String With your subject Or variable"
    29.         .Body = "replace this String With your subject Or variable"
    30.         .Body = .Body & vbCrLf & "In this manner you can create a body larger than 256 characters"
    31.  
    32. ' Add attachments to the message.
    33.         If Not IsMissing(AttachmentPath) Then
    34.             Set objOutlookAttach = .Attachments.Add(AttachmentPath)
    35.         End If
    36.  
    37. ' Resolve each Recipient's name.
    38.         For Each objOutlookRecip In .Recipients
    39.             objOutlookRecip.Resolve
    40.         Next
    41.  
    42. ' Should we display the message before sending?
    43.         If DisplayMsg Then
    44.             .Display
    45.         Else
    46.             .Send
    47.         End If
    48.  
    49.     End With
    50.  
    51.     Set objOutlook = Nothing
    52. End Sub

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