Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Mail mit mehr als 2 Anhängen?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Mail mit mehr als 2 Anhängen?

    This topic has been deleted. Only users with topic management privileges can see it.
    • lost in translation
      lost in translation @sigi234 last edited by

      @sigi234 said in Mail mit mehr als 2 Anhängen?:

      @lost-in-translation sagte in Mail mit mehr als 2 Anhängen?:

      gibt es eine Möglichkeit, mehr als 2 Bilder an eine Mail anzuhängen?

      Und wenn du das send Blockly kopierst und untereinander einfügst?

      Dann verschicke ich 2 emails. Das ist die unelegante Lösung, die ich vermeiden wollte. Wird vor allem richtig doof, wenn man mal 15 Bilder verschicken will.

      ciao
      frank

      sigi234 1 Reply Last reply Reply Quote 0
      • lost in translation
        lost in translation @thewhobox last edited by

        @thewhobox said in Mail mit mehr als 2 Anhängen?:

        @lost-in-translation Hab mir grad mal den Code angeschaut. Es geht ohne änderungen im Code nicht.

        Heisst ich bin der erste mit dieser ungewöhnlichen Idee? Oder gibt es alternative Lösungswege?
        Es würde mir ja reichen, wenn ich die Dateien mit Trenner in eins der beiden einfügen könnte. Spontan fallen mir da als Möglichkeiten ein: |;,!& Aber da muss natürlich der Code von wissen.

        ciao

        frank

        thewhobox 1 Reply Last reply Reply Quote 0
        • thewhobox
          thewhobox @lost in translation last edited by

          @lost-in-translation Der code weiß davon nix. Die zwei Dateien sind hardcodiert. Dafür müsste man den Code ändern und ein PR auf GIthub aufmachen.

          lost in translation 1 Reply Last reply Reply Quote 0
          • lost in translation
            lost in translation @thewhobox last edited by

            @thewhobox said in Mail mit mehr als 2 Anhängen?:

            @lost-in-translation Der code weiß davon nix. Die zwei Dateien sind hardcodiert. Dafür müsste man den Code ändern und ein PR auf GIthub aufmachen.

            PR? Pheature Request?

            ciao

            frank

            thewhobox 2 Replies Last reply Reply Quote 0
            • thewhobox
              thewhobox @lost in translation last edited by

              @lost-in-translation Pull Request. oder machst nen Issue auf.

              1 Reply Last reply Reply Quote 0
              • sigi234
                sigi234 Forum Testing Most Active @lost in translation last edited by sigi234

                @lost-in-translation sagte in Mail mit mehr als 2 Anhängen?:

                @sigi234 said in Mail mit mehr als 2 Anhängen?:

                @lost-in-translation sagte in Mail mit mehr als 2 Anhängen?:

                gibt es eine Möglichkeit, mehr als 2 Bilder an eine Mail anzuhängen?

                Und wenn du das send Blockly kopierst und untereinander einfügst?

                Dann verschicke ich 2 emails. Das ist die unelegante Lösung, die ich vermeiden wollte. Wird vor allem richtig doof, wenn man mal 15 Bilder verschicken will.

                ciao
                frank

                Das ist mir klar, war auch nur einen Notlösung..........😉

                1 Reply Last reply Reply Quote 0
                • thewhobox
                  thewhobox @lost in translation last edited by

                  @lost-in-translation Bzw. es gibt schon einen Issue:
                  https://github.com/iobroker-community-adapters/ioBroker.email/issues/11

                  Diginix created this issue in iobroker-community-adapters/ioBroker.email

                  open Blockly optional more attachments than only 2 #11

                  1 Reply Last reply Reply Quote 0
                  • thewhobox
                    thewhobox @lost in translation last edited by

                    @lost-in-translation Als Workaround kannst du auch im Blockly eine Javascriptfunktion aufrufen und dann per sendTo mehrere Dateien verschicken:

                    sendTo("email", {
                        from:    "iobroker@mydomain.com",
                        to:      "aabbcc@gmail.com",
                        subject: "Message from ioBroker",
                        html: "<p>Embedded image: <img src='cid:image1'/></p>",
                        attachments:[
                            {path: "path/to/file/image1.jpg", cid: "image1"}
                        ]
                    });
                    
                    lost in translation 1 Reply Last reply Reply Quote 0
                    • lost in translation
                      lost in translation @thewhobox last edited by

                      @thewhobox said in Mail mit mehr als 2 Anhängen?:

                      sendTo("email", { from: "iobroker@mydomain.com", to: "aabbcc@gmail.com", subject: "Message from ioBroker", html: "<p>Embedded image: <img src='cid:image1'/></p>", attachments:[ {path: "path/to/file/image1.jpg", cid: "image1"} ] });

                      Hab ich ausprobiert:
                      444e8fcc-5159-4ded-bf9f-85a068dc730b-image.png

                      sendTo("email", {
                          from:    Absender,
                          to:      Empfaenger,
                          subject: Betreff,
                          // html: "<p>Embedded image: <img src='cid:image1'/></p>",
                          html: HTML,
                            //  {path: "path/to/file/image1.jpg", cid: "image1"}
                            //  {path: "path/to/file/image2.jpg", cid: "image2"}
                         attachments:[
                             Bilder
                          ]
                      });
                      

                      Ergibt zwar keine Fehlermeldung, aber auch keine Mail im Eingangskorb 😞

                      so rein syntaktisch müsste das doch stimmen?

                      ciao

                      frank

                      thewhobox 1 Reply Last reply Reply Quote 0
                      • thewhobox
                        thewhobox @lost in translation last edited by

                        @lost-in-translation Nein da hast nen kleinen Fehler drin.

                        attachments: Bilder
                        

                        ich nehem mal an, dass die Variable Bilder bereits eine Array ist.

                        lost in translation 1 Reply Last reply Reply Quote 0
                        • lost in translation
                          lost in translation @thewhobox last edited by

                          @thewhobox

                          Hmm.
                          mal geändert:
                          e63cf017-fdd2-420c-b054-8539bf558de5-image.png
                          und

                          sendTo("email", {
                              from:    Absender,
                              to:      Empfaenger,
                              subject: Betreff,
                              // html: "<p>Embedded image: <img src='cid:image1'/></p>",
                              html: HTML,
                                //  {path: "path/to/file/image1.jpg", cid: "image1"}
                                //  {path: "path/to/file/image2.jpg", cid: "image2"}
                             attachments: Bilder
                          });
                          

                          Hat jetzt auch nicht den gewünschten Erfolg 😞

                          Ich bräuchte mal ein Beispiel mit 2 oder besser 3 Attachments, wo die Filepaths per Variable an die Funktion rüberkommen.

                          stell mich grad etwas blöd an. 😞

                          ciao

                          frank

                          thewhobox 2 Replies Last reply Reply Quote 0
                          • thewhobox
                            thewhobox @lost in translation last edited by

                            @lost-in-translation Du übergibst ihm einen reinen Text, das musst du noch in ein Object konvertieren.

                            attachments: JSON.parse(Bilder);
                            

                            Bei "erstelle Text aus" musst du path und cid in Anführungszeichen packen.
                            also:

                            [{"path": "
                            dateipfad1
                            ", "cid": "image1"}, //Hier das Komma nicht vergessen
                            [{"path": "
                            dateipfad2
                            ", "cid": "image2"}]
                            

                            Danach sollte es funktionieren.

                            1 Reply Last reply Reply Quote 0
                            • thewhobox
                              thewhobox @lost in translation last edited by thewhobox

                              @lost-in-translation Ich hab da mal schnell was zusammengeworfen:
                              b2272d72-94eb-4430-b085-031e433ea123-grafik.png

                              var attaches = [];
                              
                              for(var bild in bilder) {
                                  attaches.push({path: bilder[bild], cid: "image" + bild});
                              }
                              
                              console.log(JSON.stringify(attaches));
                              
                              sendTo("email", {
                                  from:    von,
                                  to:      an,
                                  subject: betreff,
                                  html: text,
                                 attachments: attaches
                              });
                              

                              <xml xmlns="http://www.w3.org/1999/xhtml">
                                <variables>
                                  <variable type="" id="~l@e!9OC1|4+g+U-JTZB">von</variable>
                                  <variable type="" id="_?dVQ*D,vJ)^s+HYjA2)">an</variable>
                                  <variable type="" id="HD0=-,oTf7RRdn7y;?PR">betreff</variable>
                                  <variable type="" id="eW@e*#2FAy?-0:H%Ac)J">text</variable>
                                  <variable type="" id=")`gfy$TzS213`(Zg^h?V">bilder</variable>
                                  <variable type="" id="hUY]Ldy*s?G:gWauwJp$">bild1</variable>
                                </variables>
                                <block type="procedures_callcustomnoreturn" id="`^-.85s*w*VmfN5.4V5N" x="113" y="115">
                                  <mutation name="sendmail">
                                    <arg name="von"></arg>
                                    <arg name="an"></arg>
                                    <arg name="betreff"></arg>
                                    <arg name="text"></arg>
                                    <arg name="bilder"></arg>
                                  </mutation>
                                  <value name="ARG0">
                                    <block type="text" id="/Zz+J^i9+;bI=J~?-K@r">
                                      <field name="TEXT">mir</field>
                                    </block>
                                  </value>
                                  <value name="ARG1">
                                    <block type="text" id="=nIv*ca@dlHYX?nzLdFb">
                                      <field name="TEXT">dich</field>
                                    </block>
                                  </value>
                                  <value name="ARG2">
                                    <block type="text" id="`e_PykiCeMKOpIj=/Xy$">
                                      <field name="TEXT">über uns</field>
                                    </block>
                                  </value>
                                  <value name="ARG3">
                                    <block type="text" id="yIg#u@b2M@oom=Q7X;u8">
                                      <field name="TEXT">Was geht so?</field>
                                    </block>
                                  </value>
                                  <value name="ARG4">
                                    <block type="lists_create_with" id="m}.BdOL=b*~;JojyBA;^">
                                      <mutation items="2"></mutation>
                                      <value name="ADD0">
                                        <block type="variables_get" id="ZoxcQU%bvj6ic0K@~X(H">
                                          <field name="VAR" id="hUY]Ldy*s?G:gWauwJp$" variabletype="">bild1</field>
                                        </block>
                                      </value>
                                      <value name="ADD1">
                                        <block type="variables_get" id="[KIdA/e{@s]c]zMq?Q]v">
                                          <field name="VAR" id=")`gfy$TzS213`(Zg^h?V" variabletype="">bilder</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                </block>
                                <block type="procedures_defcustomnoreturn" id="//81$GAbGVi[!{GnX=;f" x="88" y="363">
                                  <mutation statements="false">
                                    <arg name="von" varid="~l@e!9OC1|4+g+U-JTZB"></arg>
                                    <arg name="an" varid="_?dVQ*D,vJ)^s+HYjA2)"></arg>
                                    <arg name="betreff" varid="HD0=-,oTf7RRdn7y;?PR"></arg>
                                    <arg name="text" varid="eW@e*#2FAy?-0:H%Ac)J"></arg>
                                    <arg name="bilder" varid=")`gfy$TzS213`(Zg^h?V"></arg>
                                  </mutation>
                                  <field name="NAME">sendmail</field>
                                  <field name="SCRIPT">dmFyIGF0dGFjaGVzID0gW107DQoNCmZvcih2YXIgYmlsZCBpbiBiaWxkZXIpIHsNCiAgICBhdHRhY2hlcy5wdXNoKHtwYXRoOiBiaWxkZXJbYmlsZF0sIGNpZDogImltYWdlIiArIGJpbGR9KTsNCn0NCg0KY29uc29sZS5sb2coSlNPTi5zdHJpbmdpZnkoYXR0YWNoZXMpKTsNCg0Kc2VuZFRvKCJlbWFpbCIsIHsNCiAgICBmcm9tOiAgICB2b24sDQogICAgdG86ICAgICAgYW4sDQogICAgc3ViamVjdDogYmV0cmVmZiwNCiAgICBodG1sOiB0ZXh0LA0KICAgYXR0YWNobWVudHM6IGF0dGFjaGVzDQp9KTs=</field>
                                  <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                </block>
                              </xml>
                              

                              lost in translation 1 Reply Last reply Reply Quote 0
                              • lost in translation
                                lost in translation @thewhobox last edited by lost in translation

                                @thewhobox said in Mail mit mehr als 2 Anhängen?:

                                var attaches = []; for(var bild in bilder) { attaches.push({path: bilder[bild], cid: "image" + bild}); } console.log(JSON.stringify(attaches)); sendTo("email", { from: von, to: an, subject: betreff, html: text, attachments: attaches });

                                Ich stelle mich gerade blöd an. Was soll denn in die Liste?
                                b73cfdf5-2423-497b-b014-e0e5692ec686-image.png
                                bedankt sich mit Fehlermeldung:

                                23:16:58.770	error	javascript.0 script.js.Kameras.Maile_Bilder: ReferenceError: bilder is not defined
                                23:16:58.770	error	javascript.0 at sendmail (script.js.Kameras.Maile_Bilder:9:21)
                                23:16:58.770	error	javascript.0 at script.js.Kameras.Maile_Bilder:48:5
                                

                                Was kommt denn da genau rein?

                                ciao
                                frank

                                thewhobox 1 Reply Last reply Reply Quote 0
                                • thewhobox
                                  thewhobox @lost in translation last edited by

                                  @lost-in-translation der Parameter Bilder ist jetzt ein array (also eine Liste) in der nur der Pfad drin ist.
                                  Also: dateiimpfad = /mnt/meintollerpfad/x.jpeg

                                  Wenn du oben rechts auf Blockly=>JS klickt. Was steht da in Zeile 9?

                                  lost in translation 1 Reply Last reply Reply Quote 0
                                  • lost in translation
                                    lost in translation @thewhobox last edited by

                                    @thewhobox

                                    73dd3523-480a-4291-bdc3-848d60d3693c-image.png

                                    Ich vermute, ein Groß/Kleinschreibungs Problem.

                                    Versuche ich mal zu korrigieren.

                                    ciao

                                    frank

                                    thewhobox 1 Reply Last reply Reply Quote 0
                                    • thewhobox
                                      thewhobox @lost in translation last edited by

                                      @lost-in-translation Ja hast recht. Ist ein Groß/Kleinschreibfehler.

                                      ändere "for(var bild in Bilder) {"
                                      das muss ein großes B sein.

                                      Ich schreibe bei mir deswegen generell alles klein.

                                      lost in translation 1 Reply Last reply Reply Quote 0
                                      • lost in translation
                                        lost in translation @thewhobox last edited by

                                        @thewhobox
                                        das hat soweit geklappt, nun renne ich in das nächste Rätsel
                                        f5b3257c-8b5e-471f-96f1-26ad11d23d96-image.png
                                        Der Plan: ich speichere die vermailten Dateien zusätzlich auf dem NAS und lösche sie dann
                                        Im ersten Wurf hatte ich einen eigenen exec für den rm, dann war da immer nur der letzte Dateiname drin.
                                        Dann habe ich es einfach in einen Befehl aneinandergehängt, was grundsätzlich klappte, aber anscheinend zu viele scp Befehle parallel provozierte. Zufällige Dateien kamen nicht auf dem NAS an. Also wollte ich die Schleife mit angezogener Handbremse durchlaufen, und nur alle 100ms einen SCP absetzen. Jetzt haben aber alle scp den letzten Dateinamen aus der Liste zum Inhalt. What the f...?

                                        Irgendwie ist mir die Logik bei Blockly noch fremd. Und warum habe ich in der Konstellation nicht alle Dateinamen, sondern nur den letzten?

                                        ciao
                                        frank

                                        thewhobox 1 Reply Last reply Reply Quote 0
                                        • thewhobox
                                          thewhobox @lost in translation last edited by

                                          @lost-in-translation das liegt an Javascript. Die Schleife wartet nicht auf das Timeout sondern macht munter weiter und ist schon lange fertig, wenn der erste Timeout abläuft.
                                          Aber auch die Idee ist nicht zielführend, da mit dem Timeout auch einfach alle Befehle gleichzeitig nach 100ms ausgeführt werden.

                                          Ich schaue es mir später nochmal in Ruhe an

                                          lost in translation 1 Reply Last reply Reply Quote 0
                                          • lost in translation
                                            lost in translation @thewhobox last edited by

                                            @thewhobox
                                            Irgendwie ist der exec untauglich für Schleifen. Weil der ist einfach zu Ende und die Schleife geht in die nächste Runde, egal wie lange der aufgerufene Befehl benötigt.
                                            Und "Innendrin" ist ja auch Banane, dann hab ich keine Schleife. Wenn man etwas mehrfach durchführen will, aber Bitteschön hintereinander, dann kann man nur eine ineinander geschachtelte copy paste Orgie veranstalten. Oder übersehe ich etwas Entscheidendes?

                                            ciao

                                            Frank

                                            AlCalzone 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            405
                                            Online

                                            31.9k
                                            Users

                                            80.3k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly communication
                                            4
                                            37
                                            1631
                                            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