Public x As Outlook.Application
Public inboxMailFolder As MAPIFolder
Public junkMailFolder As MAPIFolder
Public namespc As NameSpace
Public fso As FileSystemObject
Public f As TextStream
Sub MailAbuseMacro()
Set fso = New FileSystemObject
Set x = ThisOutlookSession.Application
Set namespc = x.GetNamespace("MAPI")
Set inboxMailFolder = namespc.GetDefaultFolder(olFolderInbox)
Set junkMailFolder =
namespc.GetDefaultFolder(olFolderDeletedItems).Folders("junk")
Set f = fso.CreateTextFile("C:\test.txt", True)
Dim msg As MailItem
Dim senderDir As String
Dim i As Integer
i = 1
For Each msg In inboxMailFolder.Items
senderDir = msg.from 'this property doesn't exist. Is there any
similar?
If (Not IsValidAddr(senderDir)) Then
msg.Move junkMailFolder
End If
Next msg
End Sub
///////////////////////////////////////////////////////////
Dentro de las propiedades del objeto MailItem, exite una
que lleva por nombre "SenderName", la cual se refiere al
campo del remitente del mensaje.
Dim myol As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim mensaje_ol As Outlook.MailItem
Dim Carpeta As Outlook.MAPIFolder
Set myol = CreateObject("Outlook.Application")
Set myNameSpace = myol.GetNamespace("MAPI")
Set myFolder = myNameSpace.Folders("Nombre_Propietario")
Set Carpeta = myFolder.Folders("Nombre_Bandeja_Entrada")
For Each mensaje_ol In Carpeta.Items
MsgBox mensaje_ol.SenderName
Next mensaje_ol
end sub
Espero que le sea de ayuda.
///////////////////////////////////////////////////////////
>-----Mensaje original-----
>Hola,
>
>Alguien sabe si es posible en Outlook conseguir la
direccion de e-mail de la
>persona que mando un mensaje a traves de alguna propiedad
del objeto
>MailItem?
>
>Estoy haciendo un macro en Outlook para filtrar mensajes
de Spam. He puesto
>parte del codigo abajo:
>
>Gracias de antemano.
>
>Un saludo
>
>Dani
>
>-----------------------
>El codigo es mas o menos asi:
>
>
>Public x As Outlook.Application
>Public inboxMailFolder As MAPIFolder
>Public junkMailFolder As MAPIFolder
>Public namespc As NameSpace
>Public fso As FileSystemObject
>Public f As TextStream
>
>
>Sub MailAbuseMacro()
>
> Set fso = New FileSystemObject
> Set x = ThisOutlookSession.Application
> Set namespc = x.GetNamespace("MAPI")
> Set inboxMailFolder = namespc.GetDefaultFolder
(olFolderInbox)
> Set junkMailFolder =
>namespc.GetDefaultFolder(olFolderDeletedItems).Folders
("junk")
> Set f = fso.CreateTextFile("C:\test.txt", True)
>
> Dim msg As MailItem
> Dim senderDir As String
> Dim i As Integer
> i = 1
>
> For Each msg In inboxMailFolder.Items
>
> senderDir = msg.from 'this property doesn't
exist. Is there any
>similar?
>
> If (Not IsValidAddr(senderDir)) Then
> msg.Move junkMailFolder
> End If
>
> Next msg
>
>
>End Sub
               (
geocities.com/es/ensolva/Descargas)                   (
geocities.com/es/ensolva)                   (
geocities.com/es)