|
-
Nov 19th, 2001, 06:29 AM
#1
Thread Starter
Hyperactive Member
Email sending whit VB,
Hi,
I need to program something but i don't know if it is possible. What i need to program is that when i send a email whit Outlook i need that outlook send a copy of the same email to another email adres, So that the administrator recieve a copy from every sent email. Is that possible in Outlook? or better can ik program it self whit vb?
Is it possible whit vb to delete automatical all the emails in the "sended box or in box" from outlook?
Thanks for your help.
-
Nov 19th, 2001, 07:19 AM
#2
Set a reference to the MS Outlook Object Library and use this:
VB Code:
Private Sub SendMessage(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(txtSendTo.Text)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Administrator Account")
objOutlookRecip.Type = olCC
' 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"
'.Importance = olImportanceHigh 'High importance
' 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
-
Nov 19th, 2001, 07:36 AM
#3
Thread Starter
Hyperactive Member
Hack
Hi HACK,
thank you verry mutch for replying to my question. But that example what does it exactly? how must it be run?
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
|