We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2762
    • 1,198 Posts
    Quote from: Commodore64 at Jan 24, 2006, 02:18 AM

    Quote from: Djamoer at Jan 23, 2006, 07:30 PM

    I just realize that there will be security breach in this snippet. Somebody can post to this snippet, and able to be subscribed into certain web group, as long as they know the web group that they are aiming to.

    Any other suggestion to fix this?

    The following solution should be easy to implement.

    The admin creates some web user groups that are dedicated to the newsletter snippet only. They represent the "distribution lists" of the newsletter. For example, he creates groups "Math", "History", "English".

    In the snippet call the admin specifies which groups are to be considered newletter groups. So web users will be allowed to subscribe only to those groups only.

    Example: [[Newsletter ? newsgroups=array("Math","History","English")]]


    Nice solution Commodore wink

    O.T: Sbaglio o siamo vicini di casa?? grin
      Free MODx Graphic resources and Templates www.tattoocms.it
      -----------------------------------------------------

      MODx IT  www.modx.it
      -----------------------------------------------------

      bubuna.com - Web & Multimedia Design
      • 32241
      • 1,495 Posts
      Quote from: OpenGeek at Jan 23, 2006, 11:30 PM

      What are the groups for again? To be able to send secure content to members of certain web groups?

      Yes, the group is used to categoriezed the users that want to subscribed to the newsletter. So, when you send something, you can choose either to send it to all the web user on your MODx system, or just to certain people subscribed to certain group. You can even choose the person name one-by-one. FYI, the content will not be sent twice to the specific user, if they are subscribed to 2 different groups, and you decided to send the newsletter to that 2 groups.

      From what I can see about your suggestion, it’s more like having a mail digest, which I think is achieveable. All we need is to be able to have certain system to gather all the required data, and it can later be added to the newsletter system.

      ADDITION: I think by allowing to send a page as the newsletter, we can just create a page with MODx, and allow statistic and etc to be displayed on that page. So when we sent the newsletter, it will fetch the current statistic on that page, and it also allow you to have a lot of flexibility in the templating system.

      As far as the HTML editing, I will try implementation using RichTextEditor, and all the output will be shown in the RichTextEditor first, before it was sent out to the users.
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 32241
        • 1,495 Posts
        Quote from: Commodore64 at Jan 24, 2006, 02:18 AM

        Example: [[Newsletter ? newsgroups=array("Math","History","English")]]

        This might be the way to go, to allow hijacking by using form post to certain group. Thanks for the helps, I’ll work on that later.

        Sincerely,
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 32241
          • 1,495 Posts
          Done implementing security fix and RTE addition. The only things that still a problem to me is, how to auto-fill the RTE form, if I use the same kind of approach with NewsPublisher?

          Thanks
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 18397
            • 3,250 Posts
            Check out this thread towards the end:

            http://modxcms.com/forums/index.php/topic,1321.0.html
              • 32241
              • 1,495 Posts
              Ok,

              After leaving this snippet inactive for a while, I came back with a lot of new features added to the system.

              Check out http://test.djamoer.net/newsletter.html
              Username/Password: newsletter/djamoer

              Please feel free to test out the system. I use removeUser set to true, so when you unsubscribe from the system, your account information will totally be removed.

              For somebody who tried this snippet before, there is a know problem from the previous release, which causing a corrupted web user database. If you subscribed to the newsletter more than once, then the web user database will get corrupted,my suggestion will be to go to phpMyAdmin and visit the user attributes table, and remove the duplicate entry from the same uer and leave the first entry on the db. After that, please remove the web group and create a new web group again.

              Allright guys, have fun!
              Please report all problem on this thread.
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 25663 MODX Staff
                • 12,272 Posts
                I would suggest using the MemberCheck snippet (or similar) to hide options from groups that are not able to perform them, like the sending links when not logged in.

                It would also be handy to be able to see what groups are created and subscriptions on the manager side. For example, I subscribed, but I don’t see my email anywhere?
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Ahhh... actually I didn’t subscribe! You need to add the following to your form tag so it will actually function in Safari:
                  action="[~[*id*]~]"


                  I see a lot of potential with this! We really need to be able to trigger URL or image tag rewriting on a particular page for HTML newsletters to be most reliable and to really work... and that is really cool for being able to do that, btw!

                  How are the messages actually getting sent or queued? IOW, how well would this scale to sending, say, 5,000 to 10,000 recipients? 100,000?

                  And one last thing... is there a reason you’re using "{+blah+}" for what appears to be the same functionality as placeholders, which MODx uses the syntax of "[+blah+]" (brackets vs braces)?
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 25663 MODX Staff
                    • 12,272 Posts
                    More questions in studying the code in an attempt to answer my own questions... from lines 379-393, looks to be some duplication duplication:
                    <?php
                    		// Send Out Email
                    		// -- Remove duplicate email ($toemail)
                    		$toemail = array_flip($toemail);
                    		$toemail = array_flip($toemail);
                    		// -- Email $toemail ($toemail)
                    		for($i = 0; $i < count($toemail); $i++) {
                    			mail($toemail[$i], $subject, $content, $headers);
                    		}
                    		// -- Remove duplicate email ($tousers)
                    		$touemail = array_flip($touemail);
                    		$touemail = array_flip($touemail);
                    		// -- Email $touemail ($tousers)
                    		for($i = 0; $i < count($touemail); $i++) {
                    			mail($touemail[$i], $subject, $content, $headers);
                    		}
                    ?>

                    In addition, from a small optimization/best practices standpoint, my understanding is that it could be written slightly more efficiently by eliminating a ton of count iterations on the for loop:
                    <?php
                    		// -- Remove duplicate email ($tousers)
                    		$touemail = array_flip($touemail);
                    		$touemail = array_flip($touemail);
                    		// -- Email $touemail ($tousers)
                    		$j = count($touemail);
                    		for($i = 0; $i < $j; $i++) {
                    			mail($touemail[$i], $subject, $content, $headers);
                    		}
                    ?>


                    So, in answering my own question, it seems that you’re just calling the PHP in-built mail function. This would seem to lend itself to timeouts for large lists, no?
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 25663 MODX Staff
                      • 12,272 Posts
                      In thinking about all the idiosyncracies of what it takes to really and properly keep yourself out of trouble when sending emails (double-opt in, etc.), you might take a look at phplist for some inspiration on a few important items.

                      My biggest two concerns would be double-opt-in and timouts when sending to very large lists.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me