Url of unregister link - EasyNewsletter

I am using EasyNewsletter with taskqueue and I have problems getting the right URL for the unregister link. The url is created using the address of localhost (127.0.0.1:8080/plone).
I am using:
Plone 4.3.16
Product.EasyNewsletter 3.0.6 with taskqueue

In front of plone I use HAProxy and varnish.

Is there a way to force the right domain name into the link?

The correct url is tightly coupled to the current request; in an asynchronous operation, you do not have a "current" request. Thus, you will need to pass on the correct base url to the asynchronous operation and there set up a request mockup with the correct base url.

I cannot tell you how you would do this in detail. It depends on how EasyNewsletter accesses the request. It might e.g. use acquisition or zope.globalrequest. The two approaches require different measures to set up the request mockup.

If you're talking about the unsubscribe link within the newsletter sent, you can register a subscriber' for theProducts.EasyNewsletter.interfaces.IBeforePersonalizationEvent` and change whatever you feel like.

Try something like this:

    <subscriber for="Products.EasyNewsletter.interfaces.IBeforePersonalizationEvent"
        handler=".subscribers.newsletter_preprocessing" />
def newsletter_preprocessing(event):
    """Exchanging hostname for domain
       Personalization/Salutation
    """

    def replace_hostnames(self):
        """replace hostnames
        """
        return self.replace(
            '://dev', '://devreplaced').replace(
            '://localhost:25080', '://www.domain.com')

    if 'html' in event.data.keys():
        event.data['html'] = replace_hostnames(event.data['html'])

Just found some time to work on it - and it works just perfect. Thanks for your help and excuse me for the delayed response.