Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Newsletter is different in Test to Live

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 440 Views
  • AndiC
    Avatar
    Community Member
    4 Posts

    Newsletter is different in Test to Live Link to this post

    Sharp intake of breath - my first post here.

    I have been using SS for some months now with mostly good results, but recently came across a problem with teh Newsletter Module in SS 3.1.1

    When I send a test email, everything is fine - but - when I send out a live email the formatting of links is destroyed.

    Sample would be a hyperlink http://mywebsite.com is replaced with /var/www/mywebsite/newsletterlinks/bd9cd393e8add09d3e60d3c3b7da035f - which obviously doesn't work.

    Links to embeded images are likewise corrupted

    I've looked, but can't see anything similar here - any help appreciated

    Andy

    My composer.json
    {
    "name": "silverstripe/installer",
    "description": "The SilverStripe Framework Installer",
    "require": {
    "php": ">=5.3.2",
    "silverstripe/cms": "3.1.1",
    "silverstripe/framework": "3.1.1",
    "silverstripe-themes/simple": "*",
    "titledk/cloudy": "dev-master",
    "silverstripe/widgets": "*",
    "silverstripe/blog": "*",
    "simplepie/simplepie": "*",
    "silverstripe/comments": "*",
    "silverstripe/userforms": "*",
    "ezyang/htmlpurifier": "*",
    "silverstripe/file-listing": "*",
    "purplespider/basic-galleries": "dev-master",
    "silverstripe/newsletter": "*",
    "silverstripe/spamprotection": "*",
    "silverstripe/recaptcha": "*",
    "silverstripe/docsviewer": "*",
    "silverstripe/behat-extension": "*",
    "silverstripe/buildtools": "*",
    "silverstripe/googlesitemaps": "*"
    },
    "config": {
    "process-timeout": 600
    },
    "minimum-stability": "dev"
    }

  • Sygmoral
    Avatar
    Community Member
    23 Posts

    Re: Newsletter is different in Test to Live Link to this post

    I just recently installed the dev-master (because older wouldn't work on SS 3.1), and have the same problem. I'm trying to find how to fix it, hoping I will in time before presenting it tomorrow.

    In any case, I think I'm interested in contributing to this module (since I need it myself anyway). It looks like it has a lot of interesting features, but a lot of them are currently broken.

    I have never really contributed to an open source project before. Should I contact someone first, or just start making changes and uploading them as patch suggestions on github or something?

  • Sygmoral
    Avatar
    Community Member
    23 Posts

    Re: Newsletter is different in Test to Live Link to this post

    Took me longer than it should have, but the issue is the queued message sending, because requests on those do not occur from a normal HTTP request, and therefore SilverStripe's base_tag is wrong.

    This causes the URLs in the queued emails to be messed up with absolute URLs to the filesystem, rather than to the website URL.

    Is there a clean way to set the CORRECT SilverStripe base directory upon its startup? Isn't that saved somewhere? Then it could revert to that when it can't find it from the _SERVER variable.

    For now, I'm using a hardcoded workaround, replacing the long filesystem path with the website path (at the start of Mailer::sendHTML). I also had to disable tracking, since the original URLs had the filesystem path in them too, and I didn't want to start checking how to work around that too just yet (NewsletterEmail::_construct, disable the entire if clause starting on line 72).

    If the base_tag issue for queued requests can be fixed, it would solve these issues in a better way.

  • Sygmoral
    Avatar
    Community Member
    23 Posts

    Re: Newsletter is different in Test to Live Link to this post

    I found a better way to fix this issue: in my website's _config, I now have this:

    if(!$_SERVER['HTTP_HOST'])
    Director::setBaseURL('http://www.example.org/');
    // put your own website there, including the / at the end

    That makes sure that Director does not totally mess up the base directory when SilverStripe is called from cron, or whatever it is that messagequeue does in order to send newsletter emails. This makes it so that the newsletter module works again, with link tracking and everything.

    Now, on to making the images tracable... which I suppose is 100% new work.

    440 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.