We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9624
    • 1 Posts
    Hi all

    Got the Module almost working.

    My issue:

    Every subscriber recieves every Newsletter, no matter what selection he choosed while the registration.
    Does anyone else have this problem? Or know a solution?

    Regards
    feuillet
      • 26466
      • 10 Posts
      I’ve made a number of changes to the TXnewsletter, many of which I think could be incorporated into the next release (after, of course, I complete the job in which the changes are necessary)

      As I have not contributed to any open source project, I think it is time. But- is this the correct forum, or, if not, where would I post Mods/suggestions?

      I have:
      - replaced call to mail() with Swift mailer (allows different SMTP server)
      - set up replace for user defined variables (eg, replace {name} with the recipients name)
      - enforced account confirmation through a link sent in a mail when a user subscribes
      - newsletters are only sent to confirmed users
      - a (partial) tracking system so that user clicks through to the site can be recorded.

      I do need to complete my current job and tidy and comment the source code first.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You could just use the phpmailer class that comes with MODx (manager/includes/controls/class.phpmailer.php), although I also like the Swift mailer class.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 4268
          • 1 Posts
          I had an issue with a broken layout when following the unsubscribe link. I think I traced it to a missing closing div tag in the html generated by TXNewsletters.

          In the function "formHTMLeditMod", depending on what form elements are rendered in your implementation, a div of class "TXNewsletters_form_item", opened around line 964 of txnewsletters.inc.php, may not be closed, resulting in a ripple effect that may cause layout errors.

          I added an additional closing div tag at line 1011 and it fixed the problem.
          // line 1011 before patch
          $html .= '</div></div>';
          
          
          // line 1011 after patch
          $html .= '</div></div></div>';
          
          
          

            • 6726
            • 7,075 Posts
            Checking up... any progress with a proper email validation scheme in TX Newsletters ?
            cf http://modxcms.com/forums/index.php/topic,24195.msg168242.html#msg168242
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 9130
              • 171 Posts
              Quote from: davidm at Jul 21, 2009, 03:02 PM

              Checking up... any progress with a proper email validation scheme in TX Newsletters ?
              cf http://modxcms.com/forums/index.php/topic,24195.msg168242.html#msg168242

              I have a version where I replaced the email validation scheme and added optional email confirmation. I can upload it if you want.
                • 5369
                • 1 Posts
                I don’t know where y’all are accepting patches for this project, so I’ll just describe the fix.
                line 1536
                      $result=mail('', $subject,'', $headers);
                
                

                Each of the variables in the mail function mean something.
                mail($emailTo, $subject, $body, $headers);
                

                Because the first is left blank and To: header is created in line 1528, you end up with two "To" fields. The first is empty. This may mess up some clients where the recipient believes they are a bcc instead of the intended recipient.

                The third variable, $body, is the body. Concatenating the body onto the end of the headers creates errors in multipart messages for some clients. Headers are headers. Body is Body. Resulting code should look like:

                  function sendNewsletterMail ($emails,$emailFrom,$newsletterId,$subject) {
                
                    global $modx;
                
                          
                
                    $html = sendHTML($newsletterId);
                
                    foreach ($emails as $id => $datas) {
                
                      
                
                      $email = $datas['val'];
                
                      $timestamp = $datas['timestamp'];
                
                      $MD5 = ControlMD5($email,$timestamp);
                
                      $link = 'http://'.$_SERVER['HTTP_HOST'].'/index.php?&id='.$modx->TXNewsletters['idPageUnsubscribe'].'&action=del&email='.$email.'&control='.$MD5;
                
                      $send_html = preg_replace('#(\{link_unsubscribe\})#', $link, $html);
                
                      
                
                      $headers  = 'From: ' . $emailFrom . "\n";
                
                //      $headers .= 'To: ' . $email . "\n";
                
                      $headers .= 'Return-Path: ' . $emailFrom . "\n";
                
                      $headers .= 'MIME-Version: 1.0' ."\n";
                
                      
                
                      $headers .= 'Content-Type: text/html; charset=UTF-8' ."\n";
                
                      $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";
                
                      $body .= $send_html . "\n";
                
                      
                
                      $result=mail($email, $subject, $body, $headers);
                
                
                
                    }
                
                    return $result;
                
                  }
                
                
                


                  • 32004
                  • 24 Posts
                  Hi,

                  i have installed Modx CMS in a new directory called /v1/

                  Thats a problem for the txnewsletter.

                  Example 1:
                  Newsletter preview -> I can’t see the preview. TXNewsletter take the newsletter from http://www.mysite.com/index.php?id=4
                  But that is not the right directory. The right directory is: http://www.mysite.com/v1/index.php?id=4

                  Example 2:
                  unsubcribe E-mail: http://www.mysite.com/index.php?&id=1&action=del&[email protected]&control=bad200ba893f9d9ef9324b5bcd34cacf
                  That dosen’t work. Only with the directory /v1/ does work.

                  How i can make its work?
                    • 24935
                    • 160 Posts
                    TX newsletters is great, but it needs some fixes, and nobody is really maintaining it.

                    Here is a quick fix for your problem until someone updates this module:

                    Edit assets/modules/txnewsletters/txnewsletters.inc.php

                    Change line 1480 to:
                    $httpDom = 'http://'.$_SERVER['HTTP_HOST'] . '/v1';


                    Change line 1524 to:
                    $link = 'http://'.$_SERVER['HTTP_HOST'].'/v1/index.php?&id='.$modx->TXNewsletters['idPageUnsubscribe'].'&action=del&email='.$email.'&control='.$MD5;


                    Notice I have added ’v1’ directly into the code. This isn’t really a good idea...but it will work as a temporary solution.
                      • 32004
                      • 24 Posts
                      Hi, yes thats works, but not 100%

                      I have changed all $link to /v1/

                       $link = 'http://'.$_SERVER['HTTP_HOST'].'/v1/index.php?....... 


                      But i have problem after unsubsrible. >> I want to completly unsubscribe the link goes to mysite.com/index.php. not to the directory /v1