We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13912
    • 7 Posts
    jeffrhysjones Reply #21, 16 years ago
    Any further ideas on my blank page / unable to subscribe problem?

    I was wondering - sometimes, when there’s a blank page issue, it’s due to email server stuff not working. Would anyone know if, when you subscribe, if an attempt is made to send an email to the subscriber? If so - perhaps I’ve not configured the email in the right place and this is breaking it. V frustrating, because everything else seems to work perfectly in the back end management - even exporting (not that I can import and thing to export!)

    Aside from that, any tips on getting modx to show me a bit more debug, or php for that matter.

    I’m using PHP 5.2.3

    Cheers,

    Jeff

      • 23820
      • 7 Posts
      Hey guys, i’m having some trouble with images not showing in the newsletters that are emailed out. Works sweet az in the preview link, but yea, once its emailed, no dice. Having a look at the properties shows that its not keeping the url in the image path. So instead of
      "<img src=’http://www.blahblah.com/assets/images/pic.jpg’>"
      its just using
      "<img src=’http://assets/images/pic.jpg’>". Any ideas?
      Thanks in advance.
        • 7291
        • 129 Posts
        need to set absolute links. (whole http://www.example.com/assets/images.... in the email template)
          [center]-- smiley --[/center]
          [center]New View Media - Custom Website Design[/center]
          [center]Custom Website Design & Marketing = Strategic Business![/center]
          • 23820
          • 7 Posts
          Hey, thanks for the tip. I changed the modx config to enable absolute urls, and entered the full ’http://www...’ url in the Resource Url path. When i’m editing the content of the article using TinyMCE, adding an image from the resource browser is fine, the image url shows the full http path. However, once i’ve added it, if i right click->properties of the image, it’s stripped the http:// out of the address, and is left with the ’assest/images/...’ path. So i end up with the same problem when i send the newsletter out, in the email the properties of the image doesn’t have the full url in the path. Is this a problem with TinyMCE stripping the ’http://...’ out of the image path, or is there something else i’m missing?

          Cheers.
            • 13912
            • 7 Posts
            jeffrhysjones Reply #25, 16 years ago
            OK - I have a little more info on my ’white screen’ issue on subscribing.

            PHP wasn’t outputting all error / notice messages, as soon as I did that - the culprit became clear :

            "Fatal error: Call to undefined function checkdnsrr() in D:\Modx\ACC\assets\modules\txnewsletters\txnewsletters.inc.php on line 1290"

            So this is a Windows server, and there is no such thing (so I’m told) of the checkdnsrr function in Windows.

            In order to fix this, I guess my only option is to figure out how to turn off the email domain checking system?

            I had a go at editing out most of the ’checkform’ code, and was able to subscribe. After that, I found I was unable to send emails due to another error:

            Warning: mail() [function.mail]: SMTP server response: 503 5.5.1 Need RCPT (recipient) in D:\Modx\ACC\assets\modules\txnewsletters\txnewsletters.inc.php on line 1536

            So I’m not sure if this is just a new problem - or something to do with the fact that I edited out a whole bunch of checking code?!?

            The relevant (un-edited) code is below - any ideas?

            ////////////////////////////////////////////////////////////////////////////////
            
            function checkForm () {
                global $modx;
                $unValid = NULL;
                $html ='';
            
                if (isset($_POST['TXNewsletters_form_send']) && $_POST['TXNewsletters_form_send']!='ok') {
            
                  $html = $modx->TXNewsletters['txtlang']['postdata_error'];
            
                  return $false;
            
                }
            
                else {
            
                  foreach($modx->TXNewsletters['fields'] as $id => $field) {
            
                  if ($field['ATTRIBUTE']['type']!='checkbox'){
            
                    $t = false;
            
                    foreach($_POST as $id => $value) {
            
                      if ($id == $field['ATTRIBUTE']['name']) {
            
                        if ($field['ATTRIBUTE']['type']=='email') {
            
                          $Email = $_POST[$id];
            
                          if ((preg_match('`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-_.]?[[:alnum:]])*\.([a-z]{2,4})$`',$Email))){
            
                            $domaine = substr(strstr($Email, '@'),1);
            
                            if (checkdnsrr($domaine)){$t= true;}
            
                          }
            
                        }
            
                        elseif ($field['ATTRIBUTE']['type']=='subscribe') {
            
                            $Subscribes = $_POST[$field['ATTRIBUTE']['name']];
            
                            foreach($Subscribes as $n => $value){
            
                              $t = true;
            
                            }
            
                        }
            
                        else {
            
                          if ($field['ATTRIBUTE']['mandatory']=='yes' && $_POST[$id]!='') {
            
                            $t= true;
            
                          }
            
                          elseif ($field['ATTRIBUTE']['mandatory']=='no') {
            
                            $t= true;
            
                          }
            
                        }
            
                        
                      }
            
                    }
            
                    if ($t== false) {$unValid[$field['ATTRIBUTE']['name']]=true;}
            
                  }
            
                }
            
                }
            
                return $unValid;
            
              }
            
            ////////////////////////////////////////////////////////////////////////////////
              • 23820
              • 7 Posts
              Hey,

              Just some more info on my problem with images showing in emails. Since i started using absolute URL rewrites, they show up sweet as in gmail, but not in hotmail. Right click->Properties on the image in the email shows the path in gmail includes the website url, where as hotmail strips it down to "http://assets/images..."

              Cheers
              Pranil
                • 23820
                • 7 Posts
                Hey just an update. I found that it was just TinyMCE stripping the urls, and after some googling saw that i could change the config settings of the plugin to enable full urls instead of relative ones. Cheers for your help.

                Pranil
                  • 9353
                  • 4 Posts
                  I too was having trouble with the unsubscribe link not working. It wasn’t executing the replacement. I went and had a look in txnewsletters.inc.php and on line #1541 i changed the reg pattern so the line of code is:
                  $send_html = preg_replace('/\{link_unsubscribe\}/', $link, $html);
                  and now it seems to work. smiley
                    • 23820
                    • 7 Posts
                    Hey,

                    Me again, sorry if i’m being a bit noobie, having some more trouble with this module. I’m working on a site that is hosted on a different server than the last one where i had the newsletter module working fine. I installed the module as per the instructions (pretty sure i followed them correctly, since i start from scratch three times over sad). At first i got the error from file_get_contents, so replaced that with the curl workaround (i had to use this in my other site’s setup). But now when i try to send the email it fails, and i get the error message:
                    Error during sending !
                    Some newsletters have not been sent correctly.

                    So not very descriptive. I’ve had a look through the php files, to see where this message is spat out, and its in echoed in the module on line 343, when the $result is false from the call to the function sendNewsletterMail() in the snippet. This is about as far as i got.

                    Any ideas on where to go from here? I’ve checked the php version thats running on the server, it’s 5.2.0, and the curl module is installed:
                    cURL support enabled
                    cURL Information libcurl/7.15.3 OpenSSL/0.9.8a zlib/1.2.2

                    Just as a test i made a simple script that used the php mail() function, and that worked fine. Email came through straight away.
                    Is there some server setting that i have to get changed? or am i missing something a bit simpler than that?

                    Thanks in advance
                    Pranil.
                    • Where did you send test email to? I’ve had hosts that would only allow the mail() function to send to the localhost’s mail server (i.e. I could use it for a contact form that emailed myself, but not to send mail to anyone outside the server).

                      I chose to solve the problem by changing hosting companies, but you can also switch to using SMTP in the references to the phpmailer object instead of php’s mail() function.
                        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