|
-
Aug 22nd, 2002, 10:56 AM
#1
Thread Starter
Member
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
-
Aug 22nd, 2002, 11:26 AM
#2
-
Aug 22nd, 2002, 11:45 AM
#3
Thread Starter
Member
-
Aug 22nd, 2002, 01:35 PM
#4
Thread Starter
Member
-
Aug 22nd, 2002, 01:42 PM
#5
To Send Mail
VB Code:
Private Sub SendMailMessage(DisplayMsg As Boolean, Receiver As String, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim CallDescription As String
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Receiver)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("an other person")
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Replace this String With your subject Or variable"
.Body = "replace this String With your subject Or variable"
.Body = .Body & vbCrLf & "In this manner you can create a body larger than 256 characters"
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Send
End If
End With
Set objOutlook = Nothing
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|