Fixes and split out emiling to PHP for simplicity (prior knowledge)