How To Setup Open / Click Tracking
I setup my mail server using the quick install method and it's working good.
However, I can't figure out why the open and click tracking doesn't work.
The steps I took to set this up we're:
- postal register-lets-encrypt [email protected]
- updated postal.yml with
fast_server: enabled: true bind_address: 10.16.0.17
- postal start
What am I missing?
EDIT: don't think I need to change nginx, and I need to run postal start to actually start the fast server (restarting only restarts running processes)
I think this comes down to not knowing if I have a second IP address for my server.
DigitalOcean only allows one IP per server it seems, so I'm unsure how to go about this.
I tried adding a floating ip to my DigitalOcean droplet but that had no effect, so I removed it.
I also tried adding private networking enabled as described here but still nothing.
Might need to find a new host and wait for DNS to propagate :(
If I run ip addr show eth0 then I see this:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether f6:65:2b:8c:89:ec brd ff:ff:ff:ff:ff:ff
inet 111.111.111.111/20 brd 111.155.111.155 scope global eth0
valid_lft forever preferred_lft forever
inet 10.16.0.17/16 brd 10.16.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::f465:2bff:fe8c:89ec/64 scope link
valid_lft forever preferred_lft forever
Which makes me think my local IP I can use for the fast server is 10.16.0.17.
But if I run netstat -tnlp
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 16939/[postal] web.
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 1346/beam
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 14081/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 15420/nginx -g daem
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1561/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1460/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 15420/nginx -g daem
tcp6 0 0 :::5672 :::* LISTEN 1346/beam
tcp6 0 0 :::80 :::* LISTEN 15420/nginx -g daem
tcp6 0 0 :::4369 :::* LISTEN 1561/epmd
tcp6 0 0 :::22 :::* LISTEN 1460/sshd
tcp6 0 0 :::25 :::* LISTEN 16947/[postal] smtp
tcp6 0 0 :::443 :::* LISTEN 15420/nginx -g daem
I don't see any reference to 10.16.0.17.
If I run postal status, I see:
|| fast || Quantity 1 || Command bundle exec rake postal:fast_server || Respawning 5 every 3600 seconds || Restart mode term-start || Log path none specified || Address/Port none || => fast.2 Running 21:25 pid:17119 respawns:0 port:- tag:-
But if I try to send an email, it goes to
|| => fast.2 Failed 21:26 pid:17185 respawns:5 port:- tag:-
And none of the logs in /opt/postal/log appear to give the reason why.
Found another VPS provider:
https://www.vultr.com
You can purchase a second ipv4 in the server control panel, you must hard restart for it to be active, and you make need to follow the link in the ipv4 tab in the control panel, the one in the "Need assistance? View our networking configuration tips and examples." prompt.
I can tell it's working, cause I can ping my new ipv4 ip and it doesn't timeout.
Also, if you pick the smaller ones (make sure to choose the ipv4 options, ipv6 only is no good, and if your server's memory is low, you may fail the postal quick install, unless you add a swap file, i.e. https://devanswers.co/guide-creating-swap-space-ubuntu-16-04/
However, it turns out that the fast server still fails.
It seems that this happens within a couple minutes of starting the fast process.
|| => fast.2 Running 02:10 pid:22241 respawns:4 port:- tag:-
It respawns a total of 5 times before being declared as fails.
Found error in the /tmp/postal/procodile.log file:
02:24:17 fast.5 | Started with PID 22884
02:24:19 fast.5 | => rake aborted!
02:24:19 fast.5 | => Errno::EADDRINUSE: Address already in use - bind(2) for "1.2.3.5" port 80
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:21:in `initialize'
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:21:in `new'
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:21:in `block in run'
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:20:in `each'
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:20:in `each_with_object'
02:24:19 fast.5 | => /opt/postal/app/lib/postal/fast_server/server.rb:20:in `run'
02:24:19 fast.5 | => /opt/postal/app/lib/tasks/postal.rake:33:in `block (2 levels) in <top (required)>'
02:24:19 fast.5 | => /opt/postal/vendor/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
02:24:19 fast.5 | => Tasks: TOP => postal:fast_server
02:24:19 fast.5 | => (See full trace by running task with --trace)
02:24:20 fast.5 | Warning: this process has been respawned 5 times and keeps dying.
02:24:20 fast.5 | It will not be respawned automatically any longer and will no longer be managed.
I wonder if the 0.0.0.0:80 record is too broad and causing problems. Might need to change the nginx a little after all?
root@wpsupportuk:/opt/postal/log# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 21962/[postal] web.
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 6805/beam
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 7674/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6701/nginx -g daemo
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 6883/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1035/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 6701/nginx -g daemo
tcp6 0 0 :::5672 :::* LISTEN 6805/beam
tcp6 0 0 :::80 :::* LISTEN 6701/nginx -g daemo
tcp6 0 0 :::4369 :::* LISTEN 6883/epmd
tcp6 0 0 :::22 :::* LISTEN 1035/sshd
tcp6 0 0 :::25 :::* LISTEN 22802/[postal] smtp
tcp6 0 0 :::443 :::* LISTEN 6701/nginx -g daemo
udp 0 0 1.2.3.5:123 0.0.0.0:* 1124/ntpd
udp 0 0 1.2.3.4:123 0.0.0.0:* 1124/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1124/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1124/ntpd
udp6 0 0 fe80::5400:1ff:fed7:123 :::* 1124/ntpd
udp6 0 0 ::1:123 :::* 1124/ntpd
udp6 0 0 :::123 :::* 1124/ntpd
next step was to go into /etc/nginx/sites-available/default and replace 0.0.0.0 with the main ipv4 address.
sudo systemctl restart nginx
and then did postal restart and now the fast process is running, and I it stays alive, (see if it's running by doing postal status)
|| fast || Quantity 1 || Command bundle exec rake postal:fast_server || Respawning 5 every 3600 seconds || Restart mode term-start || Log path none specified || Address/Port none || => fast.6 Running 02:34 pid:23192 respawns:0 port:- tag:-
However, it seems mail tracking still isn't working :(
I send this message <a href="http://wpsupportuk.xyz">wpsupportuk</a>
But it arrives into my gmail box still as http://wpsupportuk.xyz, and there are no open tags on the mail I open. :(
howls to the moon
How do I debug this?
Huzzah!
The last step was to setup a tracking domain, this is done inside the mail server UI, in the domains bit.
Everything working great. 👍 👍 👍
Glad you figured this out, the secondary IP is the crucial ingredient here.
Can this work with IPv6. VPSs are stingy with secondary IPv4 addresses these days.
In theory yes but you might have to configure your nginx a bit differently to guarantee access.
Hello @willpower232
The server on which the postal is installed can be taken by the additional IP of the same server for tracking.