Reenvio de e-mail cogiendo información de dentro

CRoS

Buenos días a todos,

¿Es posible que algún tipo de software recoja el contenido de un email y responda a ese contenido?

Yo recibo este mail.

Ejemplo Mail recibido:


Ordering Details

Channel: Mobile app
Paypal Transaction ID: XX-XXXXXXXXXX0
Sales Order Date: 2013-01-17
Language: English
Pick Up in-Store: Entrega a domicilio
Email: ejemplo@mv.com
Order Units: 1
Total amount: 1 €
Order Status: paid


Y responda automáticamente a:

ejemplo@mv.com

Gracias por adelantado.

Saludos.

C

Outlook / Reglas

Pero no estoy seguro que puede crear un e-mail y enviarlo.

Edit: Sí, estoy viendo la opción de responder usando una plantilla determinada. Ahora bien, obtener el email del cuerpo sí a la hora de establecer la regla, pero poco más. Dudo que se pueda enviar un email a la dirección que venga en el cuerpo del e-mail.

1 respuesta
CRoS

#2 ahí es donde esta la dificultad :)
Igualmente gracias por la respuesta!

#3 Me lo miro :)

1 respuesta
C

#3 eres programador? entonces con VBA puedes:

http://www.outlookcode.com/codedetail.aspx?id=1476

#3 lo estoy probando y funciona de lujo.

  • Entra a Outlook (tienes que activar la opción Programador si no la tienes).
  • Alt+F11 (abrir editor VBA)
  • Inserta un nuevo módulo (normal, no de clase)

Pega esto:

Option Explicit
'declare vars, cause we want to
Dim strEmailContents, strAskWrite, strTargetFolder, strMsgBody 'strings
Dim strFileName, strMyDocuments 'file and location where we save the info    'string
Dim WshShell, myOutlook, OutlookNameSpace, outlookFolder, outlookMessage 'objects
Dim iCtr                       'counter for the loopy thingy 'integer

Public Sub Proceso()

strTargetFolder = "Bandeja de Entrada"

' hook into outlook
Set myOutlook = CreateObject("Outlook.Application")
Set OutlookNameSpace = myOutlook.GetNamespace("MAPI")

For iCtr = 1 To OutlookNameSpace.Folders.Item(1).Folders.Count
    ' handle case sensitivity as I can't type worth a crap
     If LCase(OutlookNameSpace.Folders.Item(1).Folders(iCtr).Name) = LCase(strTargetFolder) Then
     'found our target :)
        Set outlookFolder = OutlookNameSpace.Folders.Item(1).Folders(iCtr)
     Exit For  ' found it so lets move on
    End If
 Next

For Each outlookMessage In outlookFolder.Items
     strMsgBody = outlookMessage.Body  ' assign message body to a Var
     ' then use Sue Moshers code to look for stuff in the body all of the following stuff in the quotes "" is specific to your needs

 strEmailContents = strEmailContents & ParseTextLinePair(strMsgBody, "adjunto")
Next

End Sub

 
Function ParseTextLinePair(strSource, strLabel)
    ' Sue Moshers code
    'commented out type declaration for VBS usgage take out fer VB usage
    Dim intLocLabel 'As Integer
    Dim intLocCRLF 'As Integer
    Dim intLenLabel 'As Integer
    Dim strText 'As String
 
' locate the label in the source text
intLocLabel = InStr(strSource, strLabel)
intLenLabel = Len(strLabel)
    If intLocLabel > 0 Then
    intLocCRLF = InStr(intLocLabel, strSource, vbCrLf)
    If intLocCRLF > 0 Then
        intLocLabel = intLocLabel + intLenLabel
        strText = Mid(strSource, _
                        intLocLabel, _
                        intLocCRLF - intLocLabel)
    Else
        intLocLabel = Mid(strSource, intLocLabel + intLenLabel)
    End If
End If
ParseTextLinePair = Trim(strText)   ' this i like
End Function

He puesto como carpeta "Bandeja de Entrada"

Lo he probado y funciona. Una vez localiza el contenido de 'texto a buscar',

strEmailContents = strEmailContents & ParseTextLinePair(strMsgBody, "texto a buscar")

devuelve en strEmailContents todo lo que viene después (me ha parecido).

Tendrás que tocar cosas en plan que sólo te devuela el email y que recorra la carpeta que tú quieres.

En cuanto a escribir un nuevo e-mail, en VBA es muy fácil. Busca tutoriales por ahí.

Edit 2: No te fíes de lo que se ha comentado dentro de

, lo está pintando mal el foro. Haz un copy&paste tal cual.
1 1 respuesta
CRoS

Muchas gracias #4

Miro de implementarlo y te comento :)

Un saludo!

1
11 días después
CRoS

Al final no fue necesario. Quiza en un futuro!

1
CRoS

Al final no fue necesario. Quiza en un futuro!

1
CRoS

Al final no fue necesario. Quiza en un futuro!

1
eXtreM3

Pero fue o no fue necesario al final?

C

Al final no fue futuro. Quiza en un necesario!

Usuarios habituales

  • eXtreM3
  • CRoS