We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6038
    • 228 Posts
    I was having a weird problem where the mailing list pop-up page would not work for me.

    After applying the mooltools script reference in the head of my subscribe template, as mentioned previously, the subscribe was working ok (save for the fact there is no js validation before submitting whatsoever!)

    I also had to apply the no-message-content fix (again above) before I would receive any test emails.

    Trying to view the list of subscribers brought up a blank page - I discovered in my error logs this:
    [tt] PHP Fatal error: Call to undefined function json_encode() in /var/www/html/assets/modules/temailer/DrasticTools/drasticSrcMySQL.class.php on line 177[/tt]

    Seems that the drasticSrcMySQL class is only suited for php5.2 and up. I am on 5.1.8.

    I have found a manually written function that will do the job, so I am going to hack that in to the module to get it to work for me. You can see it too in the php manual comments for the json_encode function:
    http://www.php.net/manual/en/function.json-encode.php#82904
      • 9994
      • 133 Posts
      Can’t get an image to send correct. When i upload an image into the content and look into my emailpage i have the url assets/images/xxx.jpg but it has to be http://www.site.com/assets/images/...

      So I made an TV and added into the template: <img src="http://www.site.com/[*image*]"> but the TV url isnt send into the email.
      I get when i look into the source: <img src="http://www.site.com/">

      I’ve seen the fix in this form to add tv’s to TEMailer but it doesnt work for me. Why isnt the TEMailer sending the TV url sad



      // Also when i send a testmail as long as i keep the page open after clicking send, it keeps sending testmails till i open a other page.
        Best CMS eva!
        • 6038
        • 228 Posts
        hi fourroses, the fix here (http://modxcms.com/forums/index.php/topic,19146.msg132183.html#msg132183) does work - i have just applied it myself and its working ok. You might need to debug your code.
        Here is a guide to what you should have:

        Edit the /assets/modules/temailer/ajax/send.php file:
        after this line:
        //get the selected newsletter
        $doc = $modx->getDocument($id);
        

        add this:
        //get any template variable values for this doc
        $tvs = $modx->getTemplateVarOutput('*', $id);
        

        then after these lines:
        //replace template variables for proper output
        $body = insert('content', $intro . $doc['content'], $template['content']);
        $body = insert('longtitle', $doc['longtitle'], $body);					
        

        add this:
        $body = insert('image', $tvs['image'], $body);


        find file /manager/includes/document.parser.class.php
        then in the document parser class,
        Im using Evo 1.0.2, and its line 1954..

        from:
        		$baspath= $this->config["base_path"] . "manager/includes";
        

        to:
        $baspath= "/enter/your/full/server/path/to/manager/includes/folder/here";
        


        This is not the ideal scenario to have to modify the document parser core file, but I’m not sure how to do it any better. Anyone with better advice please let me know!
          • 9994
          • 133 Posts
          Thanx, indeed it’s working here. Have another one installed here at my work.
          Had the same issue’s.

          Only need to remember to change the path again when im moving the website on the live server.
          Other solution would be better indeed sad
            Best CMS eva!
            • 9994
            • 133 Posts
            Finally got it working totally. laugh For 1.0.2:

            To fix the problem with images not being viewed make sure u add the base url (handmade not [(site_url)] !):
            My head looks like this.

            <head>
            <script type="text/javascript" src="manager/media/script/mootools/mootools.js"></script>
            <script src="[(base_url)]assets/modules/temailer/js/temailer.js" type="text/javascript"></script>
            <base href="http://www.site.com/"></base>
            </head>
            



            There is a message in this form where u can use multiple groups. (bwente)
            http://modxcms.com/forums/index.php/topic,19146.msg136588.html#msg136588 (Message of januari 2008)

            But I wonder how to apply this to my TEMailer. What files are changed/modified or have to use the installer again :s?
            Anyone?
              Best CMS eva!
              • 4385
              • 372 Posts
              Wow, a blast from the past! It has been awhile since I made those changes. You should be able to make the changes to your current installation, that is how I originally did it. I not sure what changes have been made since then, but the idea is simple enough.

              I downloaded the change that I posted and had a look, it looks like I only modified two files. That is wrong! That was only the installer. I am going to attach a new zip with the files from a working site. The files you need to look at are dated Jan 22, 2008 and one file dated Jan 28, 2008.

              If you already have it installed you need to create a new table to store the mailing groups.

              CREATE TABLE modx_temailinggroup (
                groupname varchar(150) NOT NULL default '',
                emailid int(11) NOT NULL default '0',
                id int(11) NOT NULL auto_increment,
                PRIMARY KEY  (id)
              ) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
              


              And add a field to the table modx_temailinglist

              `groupid` int(11) NOT NULL default '0'


              The rest of the changes are pretty simple, just adding a line or two. The problem is that you need to modify 9 pages. Just compare them one by one and you should be able to fix it.

              Good luck and keep me posted.

              Funny, no one mentioned a problem.
                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 20014
                • 200 Posts
                been browsing the temailer help thread here, and everything has worked so far...(still have to deploy though on remote server) one thing though, is that there is no required field setting, I mean I can simply click on send without filling in the email or name fields, it defines an empty row in the table, but I am worried that a bot could wreak havoc with this. I am sure that once I send emails out, since the row is empty, nothing is going to be sent to an empty row, but is there a way to have required fields.

                It seems quite a few of you at least have some understanding of php, and I hate to admit it, I am a designer, I get about as far as echo and then I slip into a coma.

                any help would be much appreciated.
                  • 4385
                  • 372 Posts
                  This is what I have done in the past. I fixed with javascript.

                  I don’t ask for the name, so I hide the text field with CSS.

                  
                  <script type="text/javascript" src="./assets/modules/temailer/js/mootools.js"></script>
                  <script type="text/javascript" src="./assets/modules/temailer/js/temailer.js"></script>
                  <script type="text/javascript" src="./assets/modules/temailer/js/subscribe.js"></script>
                  <script type = "text/javascript" >
                  function te_subscribe()
                   {
                      //signup
                      new Ajax('assets/modules/temailer/subscribe.php?action=subscribe',
                      {
                          update: $('temailer_form'),
                          method: 'post',
                          postBody: 'name=' + $('temailer_name').value + '&email=' + $('temailer_email').value
                      }).request();
                  }
                   < /script>
                  
                  <div id="temailer_form">
                  <h4>SIGN UP FOR EMAIL UPDATES</h4>
                  	<input type="text" value="Friend" class="temailer input" id="temailer_name">
                  	<input type="text" onfocus="if (this.value=='Type your email address here...') { this.value=''; }" value="Type your email address here..." class="temailer input" id="temailer_email">
                  	<input type="button" onclick="emailCheck();" class="temailer button" value="Sign Up">
                  </div>
                  
                  
                  // contents of subscribe.js //
                  
                  function emailCheck () {
                  var emailStr = $('temailer_email').value;
                  var checkTLD=1;
                  var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
                  var emailPat=/^(.+)@(.+)$/;
                  var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
                  var validChars="\[^\\s" + specialChars + "\]";
                  var quotedUser="(\"[^\"]*\")";
                  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
                  var atom=validChars + '+';
                  var word="(" + atom + "|" + quotedUser + ")";
                  var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
                  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
                  var matchArray=emailStr.match(emailPat);
                  
                  if (matchArray==null) {
                  
                  alert("Email address seems incorrect (check @ and .'s)");
                  return false;
                  }
                  var user=matchArray[1];
                  var domain=matchArray[2];
                  
                  
                  for (i=0; i<user.length; i++) {
                  if (user.charCodeAt(i)>127) {
                  alert("Ths username contains invalid characters.");
                  return false;
                     }
                  }
                  for (i=0; i<domain.length; i++) {
                  if (domain.charCodeAt(i)>127) {
                  alert("Ths domain name contains invalid characters.");
                  return false;
                     }
                  }
                  
                  
                  if (user.match(userPat)==null) {
                  alert("The username doesn't seem to be valid.");
                  return false;
                  }
                  
                  var IPArray=domain.match(ipDomainPat);
                  if (IPArray!=null) {
                  
                  // this is an IP address
                  
                  for (var i=1;i<=4;i++) {
                  if (IPArray[i]>255) {
                  alert("Destination IP address is invalid!");
                  return false;
                     }
                  }
                  te_subscribe();
                  }
                  
                  var atomPat=new RegExp("^" + atom + "$");
                  var domArr=domain.split(".");
                  var len=domArr.length;
                  for (i=0;i<len;i++) {
                  if (domArr[i].search(atomPat)==-1) {
                  alert("The domain name does not seem to be valid.");
                  return false;
                     }
                  }
                  
                  if (checkTLD && domArr[domArr.length-1].length!=2 && 
                  domArr[domArr.length-1].search(knownDomsPat)==-1) {
                  alert("The address must end in a well-known domain or two letter " + "country.");
                  return false;
                  }
                  
                  if (len<2) {
                  alert("This address is missing a hostname!");
                  return false;
                  }
                  
                  // If we've gotten this far, everything's valid!
                  te_subscribe();
                  }
                  
                    DropboxUploader -- Upload files to a Dropbox account.
                    DIG -- Dynamic Image Generator
                    gus -- Google URL Shortener
                    makeQR -- Uses google chart api to make QR codes.
                    MODxTweeter -- Update your twitter status on publish.
                    • 20014
                    • 200 Posts
                    thanks bwente! just out of consideration for you, is there any restrictions on using your code? I mean, would you mind if I used it for a client site or two if I end up sticking with temailer?
                      • 4385
                      • 372 Posts
                      You can totally use it! I posted it, I can’t own it.

                      In fact, I am sure I copied and pasted bits and pieces from all over the web to get it to work.
                        DropboxUploader -- Upload files to a Dropbox account.
                        DIG -- Dynamic Image Generator
                        gus -- Google URL Shortener
                        makeQR -- Uses google chart api to make QR codes.
                        MODxTweeter -- Update your twitter status on publish.