Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1024to1028
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Inhalte aus Emails importieren.

Inhalte aus Emails importieren.
18.11.2008 08:51:00
Stephan
Hallo,
ich habe ca. 600 Rückmeldungen von fehlerhaften Email Adressen. Dabei steht die Email Adresse, die fehlerhaft ist in dieser Email immer an der gleichen Stelle. Wie kann ich diese Email Adressen in eine Spalte von Excel importieren? Ich nutze Outlook 2007.
Danke vorweg für jede Hilfe.
grüße
Stefan

7
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Inhalte aus Emails importieren.
18.11.2008 09:53:35
Tino
Hallo,
bei mir funktioniert es so, weis aber nicht wie die Meldung von Deinem Provider aussieht.
Vielleicht wäre es auch ratsam, sollte Dein Posteingang sehr viele Mails enthalten, diese mit Regeln in einen anderen Ordner zu verfrachten, weil dieses Makro jede Mail im Posteingang untersucht.
Option Explicit

Sub Mail_Untersuchen()
   Dim objOutlook As Object
   Dim objnSpace As Object
   Dim objFolder As Object
   Dim intCounter As Integer, intCount As Integer, lRow As Long
   Dim sTxt As String, Text As String

Cells(1, "A") = "Mailaddressen": Cells(1, "A").Font.Bold = True
lRow = 2 'ab welcher Zeile einfügen 

'   hier der Text der im Betreff vorkommt 
   Text = "mail delivery failed: returning message to sender"
 With Application
   .ScreenUpdating = False
   Set objOutlook = CreateObject("Outlook.Application")
   Set objnSpace = objOutlook.GetNamespace("MAPI")
   Set objFolder = objnSpace.Folders("Persönliche Ordner").Folders("Posteingang") ' 
   intCount = objFolder.Items.Count
   
   If intCount > 0 Then
      For intCounter = intCount To 1 Step -1
        .StatusBar = "Bitte warten, es werten noch " & intCounter & " E-Mails untersucht"
         If InStr(1, LCase(objFolder.Items(intCounter).Subject), Text) > 0 Then
          On Error GoTo 1
           sTxt = objFolder.Items(intCounter).body
           sTxt = Right$(sTxt, Len(sTxt) - InStr(sTxt, "failed:") - 7)
           sTxt = Left$(sTxt, InStr(sTxt, "SMTP") - 1)
           sTxt = Replace(Replace(sTxt, ">", ""), "<", "")
           sTxt = Replace(Replace(sTxt, " ", ""), " ", "")
           Cells(lRow, "A") = .WorksheetFunction.Clean(sTxt)
           lRow = lRow + 1
1   If Err.Number <> 0 Then On Error GoTo 0: Err.Number = 0
         End If
         
      Next intCounter

   End If
   .StatusBar = False
   .ScreenUpdating = True
 End With
   Set objnSpace = Nothing
   Set objFolder = Nothing
   Set objOutlook = Nothing
End Sub


Gruß Tino

Anzeige
AW: Inhalte aus Emails importieren.
18.11.2008 10:34:34
Stephan
Cool... Danke... ich werds testen.
Stefan
AW: Inhalte aus Emails importieren.
18.11.2008 10:46:00
Stephan
Hi nochmals,
da tut sich was aber irgendwie kann ichs nicht kontrolliren:
Meine Emails sind alle im Order Junk-Email. Das habe ich im Makro soweit geändert und es scheint auch zu tun.
Der Betreff der Mails ist meist: "Undelivered Mail Returned to Sender"
Eine Änderung im Makro bewirkt, dass überhaupt keine Ergebnisse mehr angezeigt werden.
Der Inhalt der Mails sieht so aus:
This is the mail system at host mail.plenty-market.com.
I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can delete your own text from the attached returned message.
The mail system
: host mx0.gmx.de[213.165.64.100] said: 550 5.1.1
... User is unknown {mx029} (in reply to RCPT TO command)
Diese Email wäre in diesem Fall wichtig: drissyfra@gmx.de
Hilfe!
Danke und lioebe Grüße
Stefan
Anzeige
AW: Inhalte aus Emails importieren.
18.11.2008 10:48:47
Stephan
Hi nochmals,
da tut sich was aber irgendwie kann ichs nicht kontrolliren:
Meine Emails sind alle im Order Junk-Email. Das habe ich im Makro soweit geändert und es scheint auch zu tun.
Der Betreff der Mails ist meist: "Undelivered Mail Returned to Sender"
Eine Änderung im Makro bewirkt, dass überhaupt keine Ergebnisse mehr angezeigt werden.
Der Inhalt der Mails sieht so aus:
This is the mail system at host mail.plenty-market.com.
I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can delete your own text from the attached returned message.
The mail system
drissyfra@gmx.de: host mx0.gmx.de[213.165.64.100] said: 550 5.1.1
drissyfra@gmx.de... User is unknown {mx029} (in reply to RCPT TO command)
Diese Email wäre in diesem Fall wichtig: drissyfra@gmx.de
Diese ist im Email Text allerdings in > Hilfe!
Danke und lioebe Grüße
Stefan
Anzeige
AW: Inhalte aus Emails importieren.
18.11.2008 11:32:55
Tino
Hallo,
teste mal diese Version, es sind aber bestimmt weitere Einschränkungen notwendig.
Bescheftige Dich mal mit den Funktionen instr, left, right usw...
Option Explicit

'Option Explicit 
Sub GrapText()
   Dim objOutlook As Object
   Dim objnSpace As Object
   Dim objFolder As Object
   Dim intCounter As Integer, intCount As Integer, lRow As Long
   Dim sTxt As String, Text As String
   Dim strAr1, strAr2, i As Integer

Cells(1, "A") = "Mailaddressen": Cells(1, "A").Font.Bold = True
lRow = 2 'ab welcher Zeile einfügen 

'   hier der Text der im Betreff vorkommt 
   Text = LCase("Undelivered Mail Returned to Sender")
 With Application
   .ScreenUpdating = False
   Set objOutlook = CreateObject("Outlook.Application")
   Set objnSpace = objOutlook.GetNamespace("MAPI")
   Set objFolder = objnSpace.Folders("Persönliche Ordner").Folders("Junk-Email") 'Persönliche Ordner 
   intCount = objFolder.Items.Count
   
   If intCount > 0 Then
      For intCounter = intCount To 1 Step -1
        .StatusBar = "Bitte warten, es werten noch " & intCounter & " E-Mails untersucht"
         If InStr(1, LCase(objFolder.Items(intCounter).Subject), Text) > 0 Then

           sTxt = objFolder.Items(intCounter).body
           strAr1 = Split(sTxt, ">")
        On Error GoTo 1
           For i = 1 To Ubound(strAr1)
            strAr2 = Split(strAr1(i), "<")
            Cells(lRow, "A") = Cells(lRow, "A") & strAr2(Lbound(strAr2)) & ";"
           Next i
           
           lRow = lRow + 1
         End If
1   If Err.Number <> 0 Then On Error GoTo 0: Err.Number = 0
      Next intCounter

   End If
   .StatusBar = False
   .ScreenUpdating = True
 End With
   Set objnSpace = Nothing
   Set objFolder = Nothing
   Set objOutlook = Nothing
End Sub


Gruß Tino

Anzeige
AW: Inhalte aus Emails importieren.
18.11.2008 12:03:42
Tino
Hallo,
solltest du nicht zu recht kommen, stell mal eine solche Mail (Body) als *.txt Datei hier rein und
ich schaue mal heute Abend was ich für Dich machen kann.
Jetzt muss ich erstmal auf die Mittagschicht.
Vielleicht kann auch ein anderer mal sein Glück versuchen. ;-)
Gruß Tino

www.VBA-Excel.de


AW: Inhalte aus Emails importieren.
18.11.2008 12:10:17
Stephan
Ne, geht wunderbar. Nur ein Problem besteht noch, aber das bekomme ich auch noch hin.
Danke vielmals von dieser Stelle.

301 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige