Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Tester
  4. Test Adapter ioBroker.imap latest/stable

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    2.6k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.0k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.3k

Test Adapter ioBroker.imap latest/stable

Scheduled Pinned Locked Moved Tester
412 Posts 27 Posters 101.5k Views 22 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bahnuhrB bahnuhr

    @lucky_esa
    Das hab ich alles schon probiert.

    Der fetch klappt nicht.

    Bin aber einen Schritt weiter. Habe den result auseinander genommen.
    Habe nun den Buffer.
    Aber das Schreiben als Datei klappt nicht.

    12:17:25.851	info	javascript.0 (655) script.js.Scripte.test4: [120,159,62,34,56,11,1,6,144,8,0,4,0,0,0,0,0,1,0,1,0,1,7,144,6,0,8,0,0,0,228,4,0,0,0,0,0,0,232,0,1,8,129,168,22,218,93,240,137,44,92,2,1,250,15,1,0,0,0,16,0,0,0,140,215,39,216,124,209,115,79,168,22,218,93,240,137,44,92,3,0,254,15,7,0,0,0,3,0,13,52,253,63,165,14,3,0,15,52,253,63,165,14,15,49]
    12:17:25.854	info	javascript.0 (655) script.js.Scripte.test4: winmail.dat
    12:17:25.858	error	javascript.0 (655) script.js.Scripte.test4: Error: Parameter "data" needs to be a Buffer but type "object" has been passed
    
    L Online
    L Online
    Lucky_ESA
    Developer Most Active
    wrote on last edited by Lucky_ESA
    #285

    @bahnuhr Wie genau versuchst du zu schreiben? Weiter oben ist ja das Script fürs schreiben.

    > var i, result, j, json;
    > sendTo("imap.0", "getIMAPRequest", {
    >   name: "ppc@xxx",
    >    max: 20,
    >    search: '["ALL"]',
    >    fetch:  JSON.parse('{"fetch": true, "uid": [21954]}'),
    >    bodie: '{bodies: "", markSeen: false}',
    >    parse: true,
    > }, async function (result) {
    >     if (!result) {
    >         console.log("No result found!");
    >         return;
    >     }
    >     for (var i_index in result) {
    >     i = result[i_index];
    >     var j_list = getAttr(i, 'body.attachments');
    >     for (var j_index in j_list) {
    >       j = j_list[j_index];
    >       json = JSON.stringify(getAttr(j, 'content'));
    >       // Dein Anhang als Buffer
    >       // console.log(getAttr(json, 'data'));
    >       console.log(getAttr(j, 'filename'));
    >       writeFile('vis.0', getAttr(j, 'filename'), getAttr(json, 'data'), function (error) {
    >         if(error) {
    >             console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
    >         } else {
    >            console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
    > 		   // Hier an Telegram senden
    > 		       delFile('vis.0', getAttr(j, 'filename'), function (error) {
    > 				if(!error) console.log('Datei ' + getAttr(j, 'filename') +' gelöscht');
    > 		       });
    >         }
    >       });
    >     }
    >   }
    >   });
    > ```
    bahnuhrB 1 Reply Last reply
    0
    • L Lucky_ESA

      @bahnuhr Wie genau versuchst du zu schreiben? Weiter oben ist ja das Script fürs schreiben.

      > var i, result, j, json;
      > sendTo("imap.0", "getIMAPRequest", {
      >   name: "ppc@xxx",
      >    max: 20,
      >    search: '["ALL"]',
      >    fetch:  JSON.parse('{"fetch": true, "uid": [21954]}'),
      >    bodie: '{bodies: "", markSeen: false}',
      >    parse: true,
      > }, async function (result) {
      >     if (!result) {
      >         console.log("No result found!");
      >         return;
      >     }
      >     for (var i_index in result) {
      >     i = result[i_index];
      >     var j_list = getAttr(i, 'body.attachments');
      >     for (var j_index in j_list) {
      >       j = j_list[j_index];
      >       json = JSON.stringify(getAttr(j, 'content'));
      >       // Dein Anhang als Buffer
      >       // console.log(getAttr(json, 'data'));
      >       console.log(getAttr(j, 'filename'));
      >       writeFile('vis.0', getAttr(j, 'filename'), getAttr(json, 'data'), function (error) {
      >         if(error) {
      >             console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
      >         } else {
      >            console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
      > 		   // Hier an Telegram senden
      > 		       delFile('vis.0', getAttr(j, 'filename'), function (error) {
      > 				if(!error) console.log('Datei ' + getAttr(j, 'filename') +' gelöscht');
      > 		       });
      >         }
      >       });
      >     }
      >   }
      >   });
      > ```
      bahnuhrB Online
      bahnuhrB Online
      bahnuhr
      Forum Testing Most Active
      wrote on last edited by bahnuhr
      #286

      @lucky_esa
      writeFile funktioniert nicht.
      probiert habe ich oben bei fetch: seqno oder uid -> beides klappt nicht.

      
      
      var i, result, j, json;
      sendTo("imap.0", "getIMAPRequest", {
          name: "ppc@dbrp-mueller.de",
          max: 20,
          search: '["ALL", ["HEADER", "FROM", "dieter@dbrp-mueller.de"]]',
          fetch:  JSON.parse('{"fetch": false, "seqno": [23066]}'),
          bodie: '{bodies: "", markSeen: false}',
          parse: true,
      }, async function (result) {
          if (!result) {
              console.log("No result found!");
              return;
          }
          for (var i_index in result) {
              i = result[i_index];
              var j_list = getAttr(i, 'body.attachments');
              for (var j_index in j_list) {
                  j = j_list[j_index];
              var test =  getAttr(i, 'attrs.uid');
                  if (test == 23066) {
                      json = JSON.stringify(getAttr(j, 'content'));
                      // Dein Anhang als Buffer
                      console.log(getAttr(json, 'data'));
                      console.log(getAttr(j, 'filename'));
      
          writeFile('vis.0', getAttr(j, 'filename'), getAttr(json, 'data'), function (error) {
              if(error) {
                  console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
              } else {
                 console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
              }
          });
          } } }
      });
      

      In der Mitte hab ich sowas eingebaut, damit ich nur die einzige bekomme, die ich brauche:

              var test =  getAttr(i, 'attrs.uid');
                  if (test == 23066) {
      ...
      ...
      

      Und dann kommt folgends im log:

      15:26:42.374	error	javascript.0 (655) script.js.Scripte.test4: Error: Parameter "data" needs to be a Buffer but type "object" has been passed
      

      Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
      Danke.
      gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
      ScreenToGif :https://www.screentogif.com/downloads.html

      L 1 Reply Last reply
      0
      • bahnuhrB bahnuhr

        @lucky_esa
        writeFile funktioniert nicht.
        probiert habe ich oben bei fetch: seqno oder uid -> beides klappt nicht.

        
        
        var i, result, j, json;
        sendTo("imap.0", "getIMAPRequest", {
            name: "ppc@dbrp-mueller.de",
            max: 20,
            search: '["ALL", ["HEADER", "FROM", "dieter@dbrp-mueller.de"]]',
            fetch:  JSON.parse('{"fetch": false, "seqno": [23066]}'),
            bodie: '{bodies: "", markSeen: false}',
            parse: true,
        }, async function (result) {
            if (!result) {
                console.log("No result found!");
                return;
            }
            for (var i_index in result) {
                i = result[i_index];
                var j_list = getAttr(i, 'body.attachments');
                for (var j_index in j_list) {
                    j = j_list[j_index];
                var test =  getAttr(i, 'attrs.uid');
                    if (test == 23066) {
                        json = JSON.stringify(getAttr(j, 'content'));
                        // Dein Anhang als Buffer
                        console.log(getAttr(json, 'data'));
                        console.log(getAttr(j, 'filename'));
        
            writeFile('vis.0', getAttr(j, 'filename'), getAttr(json, 'data'), function (error) {
                if(error) {
                    console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                } else {
                   console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                }
            });
            } } }
        });
        

        In der Mitte hab ich sowas eingebaut, damit ich nur die einzige bekomme, die ich brauche:

                var test =  getAttr(i, 'attrs.uid');
                    if (test == 23066) {
        ...
        ...
        

        Und dann kommt folgends im log:

        15:26:42.374	error	javascript.0 (655) script.js.Scripte.test4: Error: Parameter "data" needs to be a Buffer but type "object" has been passed
        
        L Online
        L Online
        Lucky_ESA
        Developer Most Active
        wrote on last edited by
        #287

        @bahnuhr Muss ich mir mal anschauen. Hatt aber nichts mit dem Adapter zu tun. Melde mich.

        bahnuhrB 1 Reply Last reply
        0
        • L Lucky_ESA

          @bahnuhr Muss ich mir mal anschauen. Hatt aber nichts mit dem Adapter zu tun. Melde mich.

          bahnuhrB Online
          bahnuhrB Online
          bahnuhr
          Forum Testing Most Active
          wrote on last edited by
          #288

          @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

          Hatt aber nichts mit dem Adapter zu tun.

          Dass der fetch nicht funktioniert aber schon.


          Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
          Danke.
          gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
          ScreenToGif :https://www.screentogif.com/downloads.html

          L 1 Reply Last reply
          0
          • bahnuhrB bahnuhr

            @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

            Hatt aber nichts mit dem Adapter zu tun.

            Dass der fetch nicht funktioniert aber schon.

            L Online
            L Online
            Lucky_ESA
            Developer Most Active
            wrote on last edited by Lucky_ESA
            #289

            @bahnuhr So sollte es funktionieren. Mit fetch muss ich noch prüfen.

            var i, result, j, json;
            sendTo("imap.0", "getIMAPRequest", {
                name: "github@luckyskills.de",
                max: 20,
                search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                fetch:  JSON.parse('{"fetch": false, "seqno": [23066]}'),
                bodie: '{bodies: "", markSeen: false}',
                parse: true,
            }, async function (result) {
                if (!result) {
                    console.log("No result found!");
                    return;
                }
                for (var i_index in result) {
                    i = result[i_index];
                    var j_list = getAttr(i, 'body.attachments');
                    for (var j_index in j_list) {
                        j = j_list[j_index];
                        var test =  getAttr(i, 'attrs.uid');
                        console.log(test);
                        if (test == 84) {
                            json = JSON.stringify(getAttr(j, 'content'));
                            // Dein Anhang als Buffer
                            console.log(getAttr(json, 'data'));
                            console.log(getAttr(j, 'filename'));
                            writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                if(error) {
                                    console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                } else {
                                    console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                }
                            });
                        }
                    }
                }
            });
            

            Fetch funktionier auch:

            var i, result, j, json;
            sendTo("imap.0", "getIMAPRequest", {
                name: "github@luckyskills.de",
                max: 20,
                search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                fetch:  JSON.parse('{"fetch": true, "uid": [84]}'),
                bodie: '{bodies: "", markSeen: false}',
                parse: true,
            }, async function (result) {
                if (!result) {
                    console.log("No result found!");
                    return;
                }
                for (var i_index in result) {
                    i = result[i_index];
                    var j_list = getAttr(i, 'body.attachments');
                    for (var j_index in j_list) {
                        j = j_list[j_index];
                        var test =  getAttr(i, 'attrs.uid');
                        console.log(test);
                        if (test == 84) {
                            json = JSON.stringify(getAttr(j, 'content'));
                            // Dein Anhang als Buffer
                            console.log(getAttr(json, 'data'));
                            console.log(getAttr(j, 'filename'));
                            writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                if(error) {
                                    console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                } else {
                                    console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                }
                            });
                        }
                    }
                }
            });
            
            bahnuhrB 2 Replies Last reply
            0
            • L Lucky_ESA

              @bahnuhr So sollte es funktionieren. Mit fetch muss ich noch prüfen.

              var i, result, j, json;
              sendTo("imap.0", "getIMAPRequest", {
                  name: "github@luckyskills.de",
                  max: 20,
                  search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                  fetch:  JSON.parse('{"fetch": false, "seqno": [23066]}'),
                  bodie: '{bodies: "", markSeen: false}',
                  parse: true,
              }, async function (result) {
                  if (!result) {
                      console.log("No result found!");
                      return;
                  }
                  for (var i_index in result) {
                      i = result[i_index];
                      var j_list = getAttr(i, 'body.attachments');
                      for (var j_index in j_list) {
                          j = j_list[j_index];
                          var test =  getAttr(i, 'attrs.uid');
                          console.log(test);
                          if (test == 84) {
                              json = JSON.stringify(getAttr(j, 'content'));
                              // Dein Anhang als Buffer
                              console.log(getAttr(json, 'data'));
                              console.log(getAttr(j, 'filename'));
                              writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                  if(error) {
                                      console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                  } else {
                                      console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                  }
                              });
                          }
                      }
                  }
              });
              

              Fetch funktionier auch:

              var i, result, j, json;
              sendTo("imap.0", "getIMAPRequest", {
                  name: "github@luckyskills.de",
                  max: 20,
                  search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                  fetch:  JSON.parse('{"fetch": true, "uid": [84]}'),
                  bodie: '{bodies: "", markSeen: false}',
                  parse: true,
              }, async function (result) {
                  if (!result) {
                      console.log("No result found!");
                      return;
                  }
                  for (var i_index in result) {
                      i = result[i_index];
                      var j_list = getAttr(i, 'body.attachments');
                      for (var j_index in j_list) {
                          j = j_list[j_index];
                          var test =  getAttr(i, 'attrs.uid');
                          console.log(test);
                          if (test == 84) {
                              json = JSON.stringify(getAttr(j, 'content'));
                              // Dein Anhang als Buffer
                              console.log(getAttr(json, 'data'));
                              console.log(getAttr(j, 'filename'));
                              writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                  if(error) {
                                      console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                  } else {
                                      console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                  }
                              });
                          }
                      }
                  }
              });
              
              bahnuhrB Online
              bahnuhrB Online
              bahnuhr
              Forum Testing Most Active
              wrote on last edited by
              #290

              @lucky_esa
              Hallo, ich muss nochmal fragen.

              Script funktioniert, es wird eine Datei gespeichert.

              nur Problem: Die wav wird nicht abgespielt.

              Ablauf:
              Ich lasse mir per fritzbox den ab Text senden. Sieht so aus:
              bd69c971-fb08-4ff8-9d08-2b46193fbe99-image.png
              Die Datei lässt sich am pc per outlook einwandfrei abspielen. (wav Datei)
              Bei den Objekten wird bei attach 1 angezeigt.
              Dann Script gestartet:

              
              // Datei vom Anrufbeantworter speichern und per telegram senden
              
              function weiter() {
              
              // Variablen
                  var i, result, j, json, fs = require('fs'), vText = "", vUser = "Dieter";
                  var uid = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.uid").val;
                  var subject = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.subject").val;
                  var text = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.text").val;
              
              // Script
                  if (text.indexOf("Anrufbeantworter") > - 1) {           // Anrufbeantworter ist im Text enthalten
                      // Variablen
                          var Anruf_von = text.substring(text.indexOf("Der Anrufer:") + 13, text.indexOf("hat für Sie") - 1)
                          var Datum = text.substring(text.indexOf("Datum:") + 7, text.indexOf("Uhrzeit") - 1)
                          var Uhrzeit = text.substring(text.indexOf("Uhrzeit:") + 9, text.indexOf("Aufnahme") - 1)
                          var Laenge = text.substring(text.indexOf("Aufnahme") + 15, text.indexOf("Die Weiter") - 2) + " (min/sek)"
                      // Datei speichern
                          sendTo("imap.0", "getIMAPRequest", { name: "ppc@dbrp-mueller.de", max: 20, search: '["ALL"]',
                              fetch:  JSON.parse('{"fetch": true, "uid": [' + uid + ']}'), bodie: '{bodies: "", markSeen: false}', parse: true,
                          }, async function (result) { if (!result) { log("No result found!"); return; }
                          for (var i_index in result) { i = result[i_index]; var j_list = getAttr(i, 'body.attachments');
                          for (var j_index in j_list) { j = j_list[j_index]; json = JSON.stringify(getAttr(j, 'content'));
                          //log(getAttr(j, 'filename'));
                          writeFile('vis.0', '/Anrufe/'+ getAttr(j,'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                              if(error) { log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                              } else { log('Datei: ' + getAttr(j, 'filename') +' wurde gespeichert'); }
                          });
                          // Datei kopieren mit anderem Filenamen
                              setTimeout(function() { Datei_kopieren("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), "/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav"); }, 3000);
                          // Datei wieder löschen    
                          setTimeout(function() {
                              fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), function (err) { if (err) throw err;
                                  log('Datei: ' + getAttr(j, 'filename') + ' wurde gelöscht.'); });
                              fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav", function (err) { if (err) throw err;
                                  log('Datei: Anrufbeantworter.wav wurde gelöscht.'); });
                          }, 10000);
                          // Datei per telegram versenden
                              setTimeout(function() {
                                  vText = "Anruf von: " + Anruf_von + "\nDatum: " + Datum + "\nUhrzeit: " + Uhrzeit + "\nAufnahme: " + Laenge;
                                  log (vText);
                                  //vText = "test";
                                  sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav', caption: vText});
                              }, 5000);
                          } } });
                  } else {
                      log ("Anrufbeantworter ist im Text nicht enthalten; Script wird abgebrochen.");
                  }
              }
              
              on({id: "imap.0.ppc_dbrp-mueller_de.email.email_01.uid", change: "ne"}, function(obj) {     // uid von Email 1 hat sich geändert
                  log("Auslöser Email imap hat sich geändert; UID= " + obj.state.val);
                  weiter();
              }); 
              
              weiter();
              
              

              Es wird eine Datei erzeugt; diese ist aber nicht abspielbar.
              Siehst du irgendeinen Fehler.


              Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
              Danke.
              gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
              ScreenToGif :https://www.screentogif.com/downloads.html

              1 Reply Last reply
              0
              • L Online
                L Online
                Lucky_ESA
                Developer Most Active
                wrote on last edited by
                #291

                @bahnuhr Wo genau nicht abspielbar? Telegram oder hast du diese Datei auf dein PC geladen und dort funktioniert es auch nicht?

                Gruß//Lucky

                bahnuhrB 1 Reply Last reply
                0
                • L Lucky_ESA

                  @bahnuhr So sollte es funktionieren. Mit fetch muss ich noch prüfen.

                  var i, result, j, json;
                  sendTo("imap.0", "getIMAPRequest", {
                      name: "github@luckyskills.de",
                      max: 20,
                      search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                      fetch:  JSON.parse('{"fetch": false, "seqno": [23066]}'),
                      bodie: '{bodies: "", markSeen: false}',
                      parse: true,
                  }, async function (result) {
                      if (!result) {
                          console.log("No result found!");
                          return;
                      }
                      for (var i_index in result) {
                          i = result[i_index];
                          var j_list = getAttr(i, 'body.attachments');
                          for (var j_index in j_list) {
                              j = j_list[j_index];
                              var test =  getAttr(i, 'attrs.uid');
                              console.log(test);
                              if (test == 84) {
                                  json = JSON.stringify(getAttr(j, 'content'));
                                  // Dein Anhang als Buffer
                                  console.log(getAttr(json, 'data'));
                                  console.log(getAttr(j, 'filename'));
                                  writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                      if(error) {
                                          console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                      } else {
                                          console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                      }
                                  });
                              }
                          }
                      }
                  });
                  

                  Fetch funktionier auch:

                  var i, result, j, json;
                  sendTo("imap.0", "getIMAPRequest", {
                      name: "github@luckyskills.de",
                      max: 20,
                      search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                      fetch:  JSON.parse('{"fetch": true, "uid": [84]}'),
                      bodie: '{bodies: "", markSeen: false}',
                      parse: true,
                  }, async function (result) {
                      if (!result) {
                          console.log("No result found!");
                          return;
                      }
                      for (var i_index in result) {
                          i = result[i_index];
                          var j_list = getAttr(i, 'body.attachments');
                          for (var j_index in j_list) {
                              j = j_list[j_index];
                              var test =  getAttr(i, 'attrs.uid');
                              console.log(test);
                              if (test == 84) {
                                  json = JSON.stringify(getAttr(j, 'content'));
                                  // Dein Anhang als Buffer
                                  console.log(getAttr(json, 'data'));
                                  console.log(getAttr(j, 'filename'));
                                  writeFile('vis.0', getAttr(j, 'filename'), JSON.stringify(getAttr(json, 'data')), function (error) {
                                      if(error) {
                                          console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                      } else {
                                          console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                      }
                                  });
                              }
                          }
                      }
                  });
                  
                  bahnuhrB Online
                  bahnuhrB Online
                  bahnuhr
                  Forum Testing Most Active
                  wrote on last edited by
                  #292

                  @lucky_esa
                  anbei mal eine verkürzte Fassung:

                  
                  
                  var uid = 23066;
                  
                  var i, result, j, json;
                  sendTo("imap.0", "getIMAPRequest", {
                      name: "ppc@dbrp-mueller.de",
                      max: 20,
                      //search: '["ALL", ["HEADER", "FROM", "dieter@dbrp-mueller.de"]]',
                      search: '["ALL"]',
                      fetch:  JSON.parse('{"fetch": true, "uid": ['+uid+']}'),
                      bodie: '{bodies: "", markSeen: false}',
                      parse: true,
                  }, async function (result) {
                      if (!result) {
                          console.log("No result found!");
                          return;
                      }
                      for (var i_index in result) {
                          i = result[i_index];
                          var j_list = getAttr(i, 'body.attachments');
                          for (var j_index in j_list) {
                              j = j_list[j_index];
                                  json = JSON.stringify(getAttr(j, 'content'));
                                  // Dein Anhang als Buffer
                                  console.log(getAttr(json, 'data'));
                                  console.log(getAttr(j, 'filename'));
                              writeFile('vis.0', '/Anrufe/'+ getAttr(j,'filename') + uid, JSON.stringify(getAttr(json, 'data')), function (error) {
                                  if(error) { log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                  } else { log('Datei: ' + getAttr(j, 'filename') +' wurde gespeichert'); }
                              });
                  
                      }
                      }
                  });
                   
                  

                  Datei wird erzeugt und gespeichert.
                  Sie lässt sich aber nicht abspielen.

                  Was hat sich da nur geändert ?
                  Adapter, Fritzbox, Script (wo nur ?)
                  Früher hat es geklappt.


                  Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                  Danke.
                  gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                  ScreenToGif :https://www.screentogif.com/downloads.html

                  1 Reply Last reply
                  0
                  • L Lucky_ESA

                    @bahnuhr Wo genau nicht abspielbar? Telegram oder hast du diese Datei auf dein PC geladen und dort funktioniert es auch nicht?

                    Gruß//Lucky

                    bahnuhrB Online
                    bahnuhrB Online
                    bahnuhr
                    Forum Testing Most Active
                    wrote on last edited by
                    #293

                    @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                    Telegram oder hast du diese Datei auf dein PC geladen und dort funktioniert es auch nicht?

                    beides
                    kopiert auf win-PC
                    Alle programme (mediaplayer, vlc, etc.) können die Datei nicht abspielen.

                    Und in telegram klappt es auch nicht.


                    Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                    Danke.
                    gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                    ScreenToGif :https://www.screentogif.com/downloads.html

                    1 Reply Last reply
                    0
                    • L Online
                      L Online
                      Lucky_ESA
                      Developer Most Active
                      wrote on last edited by Lucky_ESA
                      #294

                      @bahnuhr Habe hier 2 Varianten. Du kannst hier auch fs auskommentieren.

                      //var fs = require('fs');
                      var i, result, j, json;
                      sendTo("imap.0", "getIMAPRequest", {
                          name: "github@luckyskills.de",
                          max: 20,
                          search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                          fetch:  JSON.parse('{"fetch": true, "uid": [84]}'),
                          bodie: '{bodies: "", markSeen: false}',
                          parse: true,
                      }, async function (result) {
                          if (!result) {
                              console.log("No result found!");
                              return;
                          }
                          for (var i_index in result) {
                              i = result[i_index];
                              var j_list = getAttr(i, 'body.attachments');
                              for (var j_index in j_list) {
                                  j = j_list[j_index];
                                  var test =  getAttr(i, 'attrs.uid');
                                  console.log(test);
                                  if (test == 84) {
                                      json = Buffer.from(getAttr(j, 'content'));
                                      // Dein Anhang als Buffer
                                      //console.log(JSON.stringify(json));
                                      //console.log(getAttr(json, 'data'));
                                      console.log(getAttr(j, 'filename'));
                                      //fs.writeFile('/opt/iobroker/temp/' + getAttr(j, 'filename'), json, 'binary', function(err) {
                                      //    if (err) {
                                      //        console.log('Fehler beim Bild speichern: ' + err, 'warn');
                                      //    } else {
                                      //        console.log('Fehler beim Bild speichern: ', 'warn');
                                      //    }
                                      //}); 
                                      writeFile('vis.0', getAttr(j, 'filename'), json, function (error) {
                                          if(error) {
                                              console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                          } else {
                                              console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                          }
                                      });
                                  }
                              }
                          }
                      });
                      
                      bahnuhrB 1 Reply Last reply
                      0
                      • L Lucky_ESA

                        @bahnuhr Habe hier 2 Varianten. Du kannst hier auch fs auskommentieren.

                        //var fs = require('fs');
                        var i, result, j, json;
                        sendTo("imap.0", "getIMAPRequest", {
                            name: "github@luckyskills.de",
                            max: 20,
                            search: '["ALL", ["HEADER", "FROM", "1234@hotmail.com"]]',
                            fetch:  JSON.parse('{"fetch": true, "uid": [84]}'),
                            bodie: '{bodies: "", markSeen: false}',
                            parse: true,
                        }, async function (result) {
                            if (!result) {
                                console.log("No result found!");
                                return;
                            }
                            for (var i_index in result) {
                                i = result[i_index];
                                var j_list = getAttr(i, 'body.attachments');
                                for (var j_index in j_list) {
                                    j = j_list[j_index];
                                    var test =  getAttr(i, 'attrs.uid');
                                    console.log(test);
                                    if (test == 84) {
                                        json = Buffer.from(getAttr(j, 'content'));
                                        // Dein Anhang als Buffer
                                        //console.log(JSON.stringify(json));
                                        //console.log(getAttr(json, 'data'));
                                        console.log(getAttr(j, 'filename'));
                                        //fs.writeFile('/opt/iobroker/temp/' + getAttr(j, 'filename'), json, 'binary', function(err) {
                                        //    if (err) {
                                        //        console.log('Fehler beim Bild speichern: ' + err, 'warn');
                                        //    } else {
                                        //        console.log('Fehler beim Bild speichern: ', 'warn');
                                        //    }
                                        //}); 
                                        writeFile('vis.0', getAttr(j, 'filename'), json, function (error) {
                                            if(error) {
                                                console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                            } else {
                                                console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                            }
                                        });
                                    }
                                }
                            }
                        });
                        
                        bahnuhrB Online
                        bahnuhrB Online
                        bahnuhr
                        Forum Testing Most Active
                        wrote on last edited by
                        #295

                        @lucky_esa

                        Ich bekomme dies nicht hin.

                        Datei wird erzeugt, aber abspielen geht nicht.


                        Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                        Danke.
                        gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                        ScreenToGif :https://www.screentogif.com/downloads.html

                        L 1 Reply Last reply
                        0
                        • bahnuhrB bahnuhr

                          @lucky_esa

                          Ich bekomme dies nicht hin.

                          Datei wird erzeugt, aber abspielen geht nicht.

                          L Online
                          L Online
                          Lucky_ESA
                          Developer Most Active
                          wrote on last edited by
                          #296

                          @bahnuhr sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                          @lucky_esa

                          Ich bekomme dies nicht hin.

                          Datei wird erzeugt, aber abspielen geht nicht.

                          Kannst du mir mal eine kleine .wav an github@luckyskills.de senden.

                          bahnuhrB 1 Reply Last reply
                          0
                          • L Lucky_ESA

                            @bahnuhr sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                            @lucky_esa

                            Ich bekomme dies nicht hin.

                            Datei wird erzeugt, aber abspielen geht nicht.

                            Kannst du mir mal eine kleine .wav an github@luckyskills.de senden.

                            bahnuhrB Online
                            bahnuhrB Online
                            bahnuhr
                            Forum Testing Most Active
                            wrote on last edited by
                            #297

                            @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                            github@luckyskills.de

                            erledigt.


                            Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                            Danke.
                            gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                            ScreenToGif :https://www.screentogif.com/downloads.html

                            L 1 Reply Last reply
                            0
                            • bahnuhrB bahnuhr

                              @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                              github@luckyskills.de

                              erledigt.

                              L Online
                              L Online
                              Lucky_ESA
                              Developer Most Active
                              wrote on last edited by
                              #298

                              @bahnuhr Das sollte funktionieren.

                              
                              
                               
                              
                              // Datei vom Anrufbeantworter speichern und per telegram senden
                              
                               
                              
                              function weiter() {
                              
                               
                              
                              // Variablen
                              
                                  var i, result, j, json, fs = require('fs'), vText = "", vUser = "Dieter";
                              
                                  var uid = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.uid").val;
                              
                                  var subject = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.subject").val;
                              
                                  var text = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.text").val;
                              
                               
                              
                              // Script
                              
                                  if (text.indexOf("Anrufbeantworter") > - 1) {           // Anrufbeantworter ist im Text enthalten
                              
                                      // Variablen
                              
                                          var Anruf_von = text.substring(text.indexOf("Der Anrufer:") + 13, text.indexOf("hat für Sie") - 1)
                              
                                          var Datum = text.substring(text.indexOf("Datum:") + 7, text.indexOf("Uhrzeit") - 1)
                              
                                          var Uhrzeit = text.substring(text.indexOf("Uhrzeit:") + 9, text.indexOf("Aufnahme") - 1)
                              
                                          var Laenge = text.substring(text.indexOf("Aufnahme") + 15, text.indexOf("Die Weiter") - 2) + " (min/sek)"
                              
                                      // Datei speichern
                              
                                          sendTo("imap.0", "getIMAPRequest", { name: "ppc@dbrp-mueller.de", max: 20, search: '["ALL"]',
                              
                                              fetch:  JSON.parse('{"fetch": true, "uid": [' + uid + ']}'), bodie: '{bodies: "", markSeen: false}', parse: true,
                              
                                          }, async function (result) { if (!result) { log("No result found!"); return; }
                              
                                          for (var i_index in result) { i = result[i_index]; var j_list = getAttr(i, 'body.attachments');
                              
                                          for (var j_index in j_list) { j = j_list[j_index]; json = Buffer.from(getAttr(j, 'content'));;
                              
                                          //log(getAttr(j, 'filename'));
                              
                                          writeFile('vis.0', '/Anrufe/'+ getAttr(j,'filename'), json, function (error) {
                              
                                              if(error) { log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                              
                                              } else { log('Datei: ' + getAttr(j, 'filename') +' wurde gespeichert'); }
                              
                                          });
                              
                                          // Datei kopieren mit anderem Filenamen
                              
                                              setTimeout(function() { Datei_kopieren("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), "/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav"); }, 3000);
                              
                                          // Datei wieder löschen    
                              
                                          setTimeout(function() {
                              
                                              fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), function (err) { if (err) throw err;
                              
                                                  log('Datei: ' + getAttr(j, 'filename') + ' wurde gelöscht.'); });
                              
                                              fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav", function (err) { if (err) throw err;
                              
                                                  log('Datei: Anrufbeantworter.wav wurde gelöscht.'); });
                              
                                          }, 10000);
                              
                                          // Datei per telegram versenden
                              
                                              setTimeout(function() {
                              
                                                  vText = "Anruf von: " + Anruf_von + "\nDatum: " + Datum + "\nUhrzeit: " + Uhrzeit + "\nAufnahme: " + Laenge;
                              
                                                  log (vText);
                              
                                                  //vText = "test";
                              
                                                  sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav', caption: vText});
                              
                                              }, 5000);
                              
                                          } } });
                              
                                  } else {
                              
                                      log ("Anrufbeantworter ist im Text nicht enthalten; Script wird abgebrochen.");
                              
                                  }
                              
                              }
                              
                               
                              
                              on({id: "imap.0.ppc_dbrp-mueller_de.email.email_01.uid", change: "ne"}, function(obj) {     // uid von Email 1 hat sich geändert
                              
                                  log("Auslöser Email imap hat sich geändert; UID= " + obj.state.val);
                              
                                  weiter();
                              
                              }); 
                              
                               
                              
                              weiter();
                              
                               
                              
                              
                              bahnuhrB falke69F 2 Replies Last reply
                              0
                              • L Lucky_ESA

                                @bahnuhr Das sollte funktionieren.

                                
                                
                                 
                                
                                // Datei vom Anrufbeantworter speichern und per telegram senden
                                
                                 
                                
                                function weiter() {
                                
                                 
                                
                                // Variablen
                                
                                    var i, result, j, json, fs = require('fs'), vText = "", vUser = "Dieter";
                                
                                    var uid = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.uid").val;
                                
                                    var subject = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.subject").val;
                                
                                    var text = getState("imap.0.ppc_dbrp-mueller_de.email.email_01.text").val;
                                
                                 
                                
                                // Script
                                
                                    if (text.indexOf("Anrufbeantworter") > - 1) {           // Anrufbeantworter ist im Text enthalten
                                
                                        // Variablen
                                
                                            var Anruf_von = text.substring(text.indexOf("Der Anrufer:") + 13, text.indexOf("hat für Sie") - 1)
                                
                                            var Datum = text.substring(text.indexOf("Datum:") + 7, text.indexOf("Uhrzeit") - 1)
                                
                                            var Uhrzeit = text.substring(text.indexOf("Uhrzeit:") + 9, text.indexOf("Aufnahme") - 1)
                                
                                            var Laenge = text.substring(text.indexOf("Aufnahme") + 15, text.indexOf("Die Weiter") - 2) + " (min/sek)"
                                
                                        // Datei speichern
                                
                                            sendTo("imap.0", "getIMAPRequest", { name: "ppc@dbrp-mueller.de", max: 20, search: '["ALL"]',
                                
                                                fetch:  JSON.parse('{"fetch": true, "uid": [' + uid + ']}'), bodie: '{bodies: "", markSeen: false}', parse: true,
                                
                                            }, async function (result) { if (!result) { log("No result found!"); return; }
                                
                                            for (var i_index in result) { i = result[i_index]; var j_list = getAttr(i, 'body.attachments');
                                
                                            for (var j_index in j_list) { j = j_list[j_index]; json = Buffer.from(getAttr(j, 'content'));;
                                
                                            //log(getAttr(j, 'filename'));
                                
                                            writeFile('vis.0', '/Anrufe/'+ getAttr(j,'filename'), json, function (error) {
                                
                                                if(error) { log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                
                                                } else { log('Datei: ' + getAttr(j, 'filename') +' wurde gespeichert'); }
                                
                                            });
                                
                                            // Datei kopieren mit anderem Filenamen
                                
                                                setTimeout(function() { Datei_kopieren("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), "/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav"); }, 3000);
                                
                                            // Datei wieder löschen    
                                
                                            setTimeout(function() {
                                
                                                fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/" + getAttr(j, 'filename'), function (err) { if (err) throw err;
                                
                                                    log('Datei: ' + getAttr(j, 'filename') + ' wurde gelöscht.'); });
                                
                                                fs.unlink("/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav", function (err) { if (err) throw err;
                                
                                                    log('Datei: Anrufbeantworter.wav wurde gelöscht.'); });
                                
                                            }, 10000);
                                
                                            // Datei per telegram versenden
                                
                                                setTimeout(function() {
                                
                                                    vText = "Anruf von: " + Anruf_von + "\nDatum: " + Datum + "\nUhrzeit: " + Uhrzeit + "\nAufnahme: " + Laenge;
                                
                                                    log (vText);
                                
                                                    //vText = "test";
                                
                                                    sendTo('telegram.0', {user: vUser, text: '/opt/iobroker/iobroker-data/files/vis.0/Anrufe/Anrufbeantworter.wav', caption: vText});
                                
                                                }, 5000);
                                
                                            } } });
                                
                                    } else {
                                
                                        log ("Anrufbeantworter ist im Text nicht enthalten; Script wird abgebrochen.");
                                
                                    }
                                
                                }
                                
                                 
                                
                                on({id: "imap.0.ppc_dbrp-mueller_de.email.email_01.uid", change: "ne"}, function(obj) {     // uid von Email 1 hat sich geändert
                                
                                    log("Auslöser Email imap hat sich geändert; UID= " + obj.state.val);
                                
                                    weiter();
                                
                                }); 
                                
                                 
                                
                                weiter();
                                
                                 
                                
                                
                                bahnuhrB Online
                                bahnuhrB Online
                                bahnuhr
                                Forum Testing Most Active
                                wrote on last edited by bahnuhr
                                #299

                                @lucky_esa
                                Danke, aber es klappt nicht.

                                Am PC kommt im wmp dies:
                                720a9c05-fb6f-499c-95c8-aca68c392b3b-image.png

                                Edit:
                                Gabs da nicht einmal einen Hinweis von @apollon77 dass das speichern mit buffer nicht mehr geht. Kann aber auch ein anderer Sachverhalt gewesen sein. Hatten wir aber schon einmal hier in diesem thread.
                                dieses hier:
                                https://forum.iobroker.net/topic/63400/test-adapter-iobroker-imap-v0-1-1-latest-stable/234?page=12


                                Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                Danke.
                                gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                ScreenToGif :https://www.screentogif.com/downloads.html

                                L 1 Reply Last reply
                                0
                                • bahnuhrB bahnuhr

                                  @lucky_esa
                                  Danke, aber es klappt nicht.

                                  Am PC kommt im wmp dies:
                                  720a9c05-fb6f-499c-95c8-aca68c392b3b-image.png

                                  Edit:
                                  Gabs da nicht einmal einen Hinweis von @apollon77 dass das speichern mit buffer nicht mehr geht. Kann aber auch ein anderer Sachverhalt gewesen sein. Hatten wir aber schon einmal hier in diesem thread.
                                  dieses hier:
                                  https://forum.iobroker.net/topic/63400/test-adapter-iobroker-imap-v0-1-1-latest-stable/234?page=12

                                  L Online
                                  L Online
                                  Lucky_ESA
                                  Developer Most Active
                                  wrote on last edited by
                                  #300

                                  @bahnuhr Dann stimmt was mit deiner Funktion Datei_kopieren nicht. Habe es getestet und es funktioniert. Hier noch an den 2 Stellen die richtige uid eintragen.

                                  Nimm mal nur diesen Code.

                                  //var fs = require('fs');
                                  var i, result, j, json;
                                  sendTo("imap.0", "getIMAPRequest", {
                                      name: "github@luckyskills.de",
                                      max: 20,
                                      search: '["ALL", ["HEADER", "FROM", "xxx@xxx.de"]]',
                                      fetch:  JSON.parse('{"fetch": true, "uid": [107]}'),
                                      bodie: '{bodies: "", markSeen: false}',
                                      parse: true,
                                  }, async function (result) {
                                      if (!result) {
                                          console.log("No result found!");
                                          return;
                                      }
                                      for (var i_index in result) {
                                          i = result[i_index];
                                          var j_list = getAttr(i, 'body.attachments');
                                          for (var j_index in j_list) {
                                              j = j_list[j_index];
                                              var test =  getAttr(i, 'attrs.uid');
                                              console.log(test);
                                              if (test == 107) {
                                                  json = Buffer.from(getAttr(j, 'content'));
                                                  // Dein Anhang als Buffer
                                                  //console.log(JSON.stringify(json));
                                                  //console.log(getAttr(json, 'data'));
                                                  console.log(getAttr(j, 'filename'));
                                                  //fs.writeFile('/opt/iobroker/temp/' + getAttr(j, 'filename'), json, 'binary', function(err) {
                                                  //    if (err) {
                                                  //        console.log('Fehler beim Bild speichern: ' + err, 'warn');
                                                  //    } else {
                                                  //        console.log('Fehler beim Bild speichern: ', 'warn');
                                                  //    }
                                                  //}); 
                                                  writeFile('vis.0', getAttr(j, 'filename'), json, function (error) {
                                                      if(error) {
                                                          console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                                      } else {
                                                          console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                                      }
                                                  });
                                              }
                                          }
                                      }
                                  });
                                  
                                  bahnuhrB 1 Reply Last reply
                                  0
                                  • L Lucky_ESA

                                    @bahnuhr Dann stimmt was mit deiner Funktion Datei_kopieren nicht. Habe es getestet und es funktioniert. Hier noch an den 2 Stellen die richtige uid eintragen.

                                    Nimm mal nur diesen Code.

                                    //var fs = require('fs');
                                    var i, result, j, json;
                                    sendTo("imap.0", "getIMAPRequest", {
                                        name: "github@luckyskills.de",
                                        max: 20,
                                        search: '["ALL", ["HEADER", "FROM", "xxx@xxx.de"]]',
                                        fetch:  JSON.parse('{"fetch": true, "uid": [107]}'),
                                        bodie: '{bodies: "", markSeen: false}',
                                        parse: true,
                                    }, async function (result) {
                                        if (!result) {
                                            console.log("No result found!");
                                            return;
                                        }
                                        for (var i_index in result) {
                                            i = result[i_index];
                                            var j_list = getAttr(i, 'body.attachments');
                                            for (var j_index in j_list) {
                                                j = j_list[j_index];
                                                var test =  getAttr(i, 'attrs.uid');
                                                console.log(test);
                                                if (test == 107) {
                                                    json = Buffer.from(getAttr(j, 'content'));
                                                    // Dein Anhang als Buffer
                                                    //console.log(JSON.stringify(json));
                                                    //console.log(getAttr(json, 'data'));
                                                    console.log(getAttr(j, 'filename'));
                                                    //fs.writeFile('/opt/iobroker/temp/' + getAttr(j, 'filename'), json, 'binary', function(err) {
                                                    //    if (err) {
                                                    //        console.log('Fehler beim Bild speichern: ' + err, 'warn');
                                                    //    } else {
                                                    //        console.log('Fehler beim Bild speichern: ', 'warn');
                                                    //    }
                                                    //}); 
                                                    writeFile('vis.0', getAttr(j, 'filename'), json, function (error) {
                                                        if(error) {
                                                            console.log('Fehler beim Speichern von Datei ' + getAttr(json, 'filename') +'   Fehler:' + error, 'warn');
                                                        } else {
                                                            console. log('Datei ' + getAttr(j, 'filename') +' wurde gespeichert');
                                                        }
                                                    });
                                                }
                                            }
                                        }
                                    });
                                    
                                    bahnuhrB Online
                                    bahnuhrB Online
                                    bahnuhr
                                    Forum Testing Most Active
                                    wrote on last edited by
                                    #301

                                    @lucky_esa

                                    So, ich geb auf.
                                    Habe das Script genommen.
                                    Dann mir selber eine Mail gesendet (mit Anhang wav Datei die ich dir gesendet habe)

                                    uid im script geändert
                                    Script gestartet
                                    in vis.0 wird Datei "winmail.dat" erzeugt (keine wav oder so ?!)
                                    Dann die Datei kopiert auf win pc
                                    Abspielen geht nicht.

                                    Wenn du magst gerne auch mal per anydesk.
                                    Ansonsten geb ich jetzt auf.
                                    Bei mir läuft es nicht.
                                    Warum auch eine dat erzeugt wird und keine wav weiß ich auch nicht.


                                    Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                    Danke.
                                    gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                    ScreenToGif :https://www.screentogif.com/downloads.html

                                    L 1 Reply Last reply
                                    0
                                    • Thomas BraunT Online
                                      Thomas BraunT Online
                                      Thomas Braun
                                      Most Active
                                      wrote on last edited by
                                      #302

                                      @bahnuhr

                                      Mal geschaut was winmail.dat ist?

                                      https://support.mozilla.org/de/kb/anhang-winmaildat

                                      Linux-Werkzeugkasten:
                                      https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
                                      NodeJS Fixer Skript:
                                      https://forum.iobroker.net/topic/68035/iob-node-fix-skript
                                      iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

                                      bahnuhrB 1 Reply Last reply
                                      0
                                      • bahnuhrB bahnuhr

                                        @lucky_esa

                                        So, ich geb auf.
                                        Habe das Script genommen.
                                        Dann mir selber eine Mail gesendet (mit Anhang wav Datei die ich dir gesendet habe)

                                        uid im script geändert
                                        Script gestartet
                                        in vis.0 wird Datei "winmail.dat" erzeugt (keine wav oder so ?!)
                                        Dann die Datei kopiert auf win pc
                                        Abspielen geht nicht.

                                        Wenn du magst gerne auch mal per anydesk.
                                        Ansonsten geb ich jetzt auf.
                                        Bei mir läuft es nicht.
                                        Warum auch eine dat erzeugt wird und keine wav weiß ich auch nicht.

                                        L Online
                                        L Online
                                        Lucky_ESA
                                        Developer Most Active
                                        wrote on last edited by Lucky_ESA
                                        #303

                                        @bahnuhr

                                        in vis.0 wird Datei "winmail.dat" erzeugt (keine wav oder so ?!)

                                        Was hast du denn als Anhang in deiner Mail. Bei welchem Provider bist du?
                                        Ich benötige mal die komplette Ausgabe von:

                                            for (var i_index in result) {
                                                i = result[i_index];
                                                console.log(JSON.stringify(i)); // Das einfügen
                                                var j_list = getAttr(i, 'body.attachments');
                                        

                                        Achtung! Dein logfile kann dann sofort auf > 20MB anwachsen.

                                        bahnuhrB 1 Reply Last reply
                                        0
                                        • L Lucky_ESA

                                          @bahnuhr

                                          in vis.0 wird Datei "winmail.dat" erzeugt (keine wav oder so ?!)

                                          Was hast du denn als Anhang in deiner Mail. Bei welchem Provider bist du?
                                          Ich benötige mal die komplette Ausgabe von:

                                              for (var i_index in result) {
                                                  i = result[i_index];
                                                  console.log(JSON.stringify(i)); // Das einfügen
                                                  var j_list = getAttr(i, 'body.attachments');
                                          

                                          Achtung! Dein logfile kann dann sofort auf > 20MB anwachsen.

                                          bahnuhrB Online
                                          bahnuhrB Online
                                          bahnuhr
                                          Forum Testing Most Active
                                          wrote on last edited by bahnuhr
                                          #304

                                          @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                                          Was hast du denn als Anhang in deiner Mail.

                                          Den Anhang den ich dir gesendet habe (...wav)

                                          @lucky_esa sagte in Test Adapter ioBroker.imap v0.1.1 latest/stable:

                                          Bei welchem Provider bist du?

                                          Strato

                                          console.log(JSON.stringify(i)); // Das einfügen
                                          

                                          Eingefügt, aber sehr groß war der log nicht !

                                          log kommt per Mail.


                                          Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                          Danke.
                                          gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                          ScreenToGif :https://www.screentogif.com/downloads.html

                                          L 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          668

                                          Online

                                          32.6k

                                          Users

                                          82.3k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Home
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe