Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. [Gelöst] Email-Empfang Iobroker

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [Gelöst] Email-Empfang Iobroker

    This topic has been deleted. Only users with topic management privileges can see it.
    • liv-in-sky
      liv-in-sky @Gargano last edited by

      @Gargano kannst du im debug-node in nodered einstellen und ansehen

      Image 4.png

      Gargano 1 Reply Last reply Reply Quote 0
      • Gargano
        Gargano @liv-in-sky last edited by

        @liv-in-sky Ich hab kein Nodered sondern es mit dem Javascript gemacht, daß weiter oben steht.

        liv-in-sky 1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @Gargano last edited by

          @Gargano dann sollte es stimmen

          hier ein beispiel von mir

          Image 5.png

          Gargano 1 Reply Last reply Reply Quote 0
          • Gargano
            Gargano @liv-in-sky last edited by

            @liv-in-sky Ich habe nur die einfache Version genommen, hier der Code.

            
            
            // Quelle Original: https://github.com/chirag04/mail-listener2
            // Quelle Forum: https://forum.iobroker.net/topic/18501/emails-empfangen
             
            const EmailText = "javascript.0.Email.EmailText";
            const EmailEingang = "javascript.0.Email.Email_Eingang";
            
            createState(EmailEingang, {
                type: 'string',
                min: 0,
                def: 0,
                role: 'value'
            });
            createState(EmailText, {
                type: 'string',
                min: 0,
                def: 0,
                role: 'value'
            });
            
            
                var MailListener = require("mail-listener2");
                var mailListener = new MailListener({
                  username: "xxxxx",    // HIER Email Adresse eintragen
                  password: "yyyy",	      // HIER Passwort eintragen	
                  host: "imap.ionos.de",
                  port: 993, // imap port
                  tls: true,
                  connTimeout: 10000, // Default by node-imap
                  authTimeout: 5000, // Default by node-imap,
                  debug: null, // Or your custom function with only one incoming argument. Default: null
                  tlsOptions: { rejectUnauthorized: false },
                  mailbox: "INBOX", // HIER Postfach eingeben z.B. INBOX 
                  searchFilter: ["UNSEEN"], // the search filter being used after an IDLE notification has been retrieved
                  markSeen: true, // all fetched email willbe marked as seen and not fetched next time
                  fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,
                  mailParserOptions: {streamAttachments: false}, // options to be passed to mailParser lib.
                  attachments: false, // download attachments as they are encountered to the project directory
                  attachmentOptions: { directory: "attachments/" } // specify a download directory for attachments
                });
            
                mailListener.start();
                mailListener.on("server:connected", function(){console.log("------- imapConnected");});
                mailListener.on("server:disconnected", function(){console.log("------- imapDisconnected");});
                mailListener.on("error", function(err){console.log("MailError "+err);});
                mailListener.on("mail", function(mail, seqno, attributes){
                
                    log("Mail from: "+mail.from[0].address);
                    log("Name: "+mail.from[0].name);
                    log("Subject: "+mail.subject);
                    log("Text: "+mail.text);
            
            //     setState(EmailEingang,mail.from[0].address);  	//setze Datenpunkt mit Email-Absender (als Trigger nutzbar)
            //     setState(EmailText,mail.text);			//setze Datenpunkt mit kompletten Email-Inhalt
                });
            
                // mailListener.on("attachment", function(attachment){console.log(attachment.path);}); //wenn Anhänge verarbeitet werden sollen einkommentieren
            
            
            

            mail.from[0].address,mail.from[0].name,mail.subject funktioniert. nur mail.text nicht

            liv-in-sky 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @Gargano last edited by liv-in-sky

              @Gargano

              das funktioniert bei mir. mail-listener4 aber sollte auch mit mail-listener2 funktionieren:

              
              
              // Quelle Original: https://github.com/chirag04/mail-listener2
              // Quelle Forum: https://forum.iobroker.net/topic/18501/emails-empfangen
               
              const EmailText = "javascript.0.Email.EmailText";
              const EmailEingang = "javascript.0.Email.Email_Eingang";
              
              createState(EmailEingang, {
                  type: 'string',
                  min: 0,
                  def: 0,
                  role: 'value'
              });
              createState(EmailText, {
                  type: 'string',
                  min: 0,
                  def: 0,
                  role: 'value'
              });
              
              
                  var MailListener = require("mail-listener4");
                   
                  var maillistenerSetting =  {
                   username: "xxxxx.de",    // hier Email Adresse eintragen
                    password: "xxxxxxxx",	      // hier Passwort eintragen	
                    host: "imap.1und1.de",
                    port: 993, // imap port
                    tls: true,
                    connTimeout: 10000, // Default by node-imap
                    authTimeout: 5000, // Default by node-imap,
                    debug: null, // Or your custom function with only one incoming argument. Default: null
                    tlsOptions: { rejectUnauthorized: false },
                    mailbox: "INBOX", // HIER Postfach eingeben z.B. INBOX 
                    searchFilter: ["UNSEEN"], // the search filter being used after an IDLE notification has been retrieved
                    markSeen: false, // all fetched email willbe marked as seen and not fetched next time
                    fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,
                    mailParserOptions: {streamAttachments: false}, // options to be passed to mailParser lib.
                    attachments: false, // download attachments as they are encountered to the project directory
                    attachmentOptions: { directory: "attachments/" } // specify a download directory for attachments
                  };
                   var MailListener = require("mail-listener4");
                  var mailListener = new MailListener(
                      maillistenerSetting
                  );
                 
                  mailListener.start();
                  mailListener.on("server:connected", function(){/*console.log("imapconconnected")*/;});
                  mailListener.on("server:disconnected", function(){/*console.log("imapDisconnected");*/});
                  mailListener.on("error", function(err){console.log(err);});
                  mailListener.on("mail", function(mail, seqno, attributes){
                  
                   //   log("Mail from: "+mail.from[0].address);
                     // log("Name: "+mail.from[0].name);
                     // log("Subject: "+mail.subject);
                      log("Text: "+mail.text);
              
              //     setState(EmailEingang,mail.from[0].address);  	//setze Datenpunkt mit Email-Absender (als Trigger nutzbar)
              //     setState(EmailText,mail.text);			//setze Datenpunkt mit kompletten Email-Inhalt
                  });
              
                  // mailListener.on("attachment", function(attachment){console.log(attachment.path);}); //wenn Anhänge verarbeitet werden sollen einkommentieren
              
              
              
              
              
              
              

              Image 6.png

              Gargano 1 Reply Last reply Reply Quote 0
              • Gargano
                Gargano @liv-in-sky last edited by

                @liv-in-sky Seltsam, bei mir geht es auch mit mail-listener4 nicht.
                Muß ich irgendetwas anderes noch eintragen außer in der Javascript Instanz ?
                592f4d05-db99-4d6c-b715-6e09db942c27-grafik.png

                liv-in-sky 2 Replies Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @Gargano last edited by

                  @Gargano

                  nein nur da- hast du mein script getestet - ist anders als deines

                  1 Reply Last reply Reply Quote 0
                  • liv-in-sky
                    liv-in-sky @Gargano last edited by

                    @Gargano

                    ich hatte bei deinem script einen fehler im log - ich nutze javascript version 4.10.5 - vielleicht macht das was aus

                    Gargano 3 Replies Last reply Reply Quote 0
                    • Gargano
                      Gargano @liv-in-sky last edited by

                      @liv-in-sky Welcher Fehler im Log war das ?

                      1 Reply Last reply Reply Quote 0
                      • Gargano
                        Gargano @liv-in-sky last edited by

                        @liv-in-sky Ich hab mal Dein Script versucht, da funktioniert gar nichts. Es kommt keine Email an.

                        liv-in-sky 1 Reply Last reply Reply Quote 0
                        • Gargano
                          Gargano @liv-in-sky last edited by

                          @liv-in-sky Ich hab die Version 4.10.8

                          1 Reply Last reply Reply Quote 0
                          • liv-in-sky
                            liv-in-sky @Gargano last edited by

                            @Gargano irgendwas mit "maillistener ist kein constructor"
                            -log ist leider schon gelöscht

                            Gargano 1 Reply Last reply Reply Quote 0
                            • Gargano
                              Gargano @liv-in-sky last edited by

                              @liv-in-sky
                              Mit deinem Script geht das Empfangen auch, dauert etwas bis es in den Objekten ist.
                              Beim mail_text steht dies drin : FEHLER beim Lesen oder leer

                              Was equivalent zu meinem Script bei mail.text = undefined ist.
                              Soweit also gleich.

                              Kann es sein, daß bei 1und1 etwas anders ist als bei gmail o.a. ?

                              liv-in-sky 1 Reply Last reply Reply Quote 0
                              • liv-in-sky
                                liv-in-sky @Gargano last edited by

                                @Gargano

                                diesen fehler hatte ich mit mails, die im html format waren - daher node red, da ist dieses problem nicht

                                teste mal ein anderes, ohne html inhalt

                                Gargano 1 Reply Last reply Reply Quote 0
                                • Gargano
                                  Gargano @liv-in-sky last edited by

                                  @liv-in-sky Heureka, das wars. Email im Raw Format geht.
                                  Danke für die Hilfe

                                  liv-in-sky 1 Reply Last reply Reply Quote 0
                                  • liv-in-sky
                                    liv-in-sky @Gargano last edited by

                                    @Gargano gerne - aber die fritzbox sendet nur im html format - ode kann man das umstellen ?

                                    Gargano 1 Reply Last reply Reply Quote 0
                                    • Gargano
                                      Gargano @liv-in-sky last edited by

                                      @liv-in-sky Ich will da nichts umstellen, weil ich die originalen Emails anderweitig anschauen will.
                                      Ich brauch das Script um Email Eingänge auf meinem LG-TV anzuzeigen, da brauch ich nur den Namen und Subject.
                                      Mich hat nur der mail.text=undefined gestört und wollte wissen wieso, jetzt weis ich es.

                                      liv-in-sky 1 Reply Last reply Reply Quote 0
                                      • liv-in-sky
                                        liv-in-sky @Gargano last edited by

                                        @Gargano dafür hätte ich schon ein script gehabt 🙂

                                        https://forum.iobroker.net/topic/36558/html-tabelle-für-email-postfach

                                        1 Reply Last reply Reply Quote 0
                                        • B
                                          Bert last edited by

                                          Hallo zusammen und frohe Weihnachten gehabt zu haben 🙂
                                          Ich stehe grad etwas auf dem Schlauch und hoffe ihr könnt mir helfen.
                                          Habe die obigen Skripte ausprobiert und bekomme auch einen Absender angezeigt wenn eine Mail eintrifft, aber ich bekomme einfach keinen Text angezeigt!
                                          Im Log taucht eine Fehlermeldung auf:

                                          (14052) script.js.common.Mail_Listener: setForeignState: undefined is not a valid state value

                                          Könnt ihr mir da weiterhelfen?

                                          Danke schonmal im Vorraus ☺

                                          1 Reply Last reply Reply Quote 0
                                          • R
                                            Rocki @sigi234 last edited by

                                            @sigi234 sagte in Email-Empfang Iobroker:

                                            @liv-in-sky sagte in Email-Empfang Iobroker:

                                            @sigi234 falls du dich damit etwas auskennst, kannst ja mal kucken, ob diese daten dort drin sind

                                            Nein nur teilweise drinnen.

                                            Screenshot (2882)_LI.jpg

                                            Hallo, nur mal eine Frage generell zu uPnp ... mir werden gar keine Daten angezeigt? An was könnte das liegen?

                                            Bildschirmfoto 2021-02-06 um 13.02.43.png

                                            liv-in-sky R 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            655
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            iobroker javascript mailistener2
                                            7
                                            101
                                            6611
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo