![]() |
|
Tipp 0259
|
E-Mails automatisch weiterleiten
|
 |
|
Autor/Einsender: Datum: |
|
Angie 03.08.2002 |
|
| Entwicklungsumgebung: |
|
Outlook 2000 |
|
|
|
Folgendes Beispiel zeigt, wie man eingehende Mails automatisch mit neuem Betreff an die angegebene E-Mail-Adresse weiterleiten kann.
|
|
Den folgenden Code z. B. in Outlook 2000 im VB-Editor unter...
|
-> Projekt1 (VbaProject.OTM)
-> Microsoft Outlook Objekte
-> DieseOutlookSitzung
|
|
... einfügen, das Projekt speichern und dann entweder Outlook schließen und neu starten oder einfach die Prozedur
Application_Startup ausführen, und schon werden alle eingehenden E-Mails automatisch weitergeleitet.
|
|
| Code im Codebereich von DieseOutlookSitzung |
|
| |
Option Explicit
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Set myOlItems = _
Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim olMailForward As MailItem
Dim sMailSubject As String
Dim sSenderName As String
If TypeName(Item) = "MailItem" Then
sSenderName = Item.SenderName
sMailSubject = Item.Subject
sMailSubject = sSenderName & ": " & sMailSubject
Set olMailForward = Item.Forward
With olMailForward
.Recipients.Add "name@domain.de"
.Subject = sMailSubject
.Send
End With
End If
End Sub
|
|
|
|
|
|
|
| Windows-Version |
| 95 |
 |
|
| 98/SE |
 |
|
| ME |
 |
|
| NT |
 |
|
| 2000 |
 |
|
| XP |
 |
|
| Vista |
 |
|
| Win
7 |
 |
|
|
| Outlook-Version |
| 95 |
 |
|
| 98 |
 |
|
| 2000 |
 |
|
| 2002
(XP) |
 |
|
| 2003 |
 |
|
| 2007 |
 |
|
| 2010 |
 |
|
|
|
Download (1,5 kB)
|
Downloads bisher: [ 1659 ]
|
|
|