The link in the email should go to your site.
Something like the following: Email -> yoursite.com/coupon.php?generate=1
coupon.php will be the php script on your server generating the coupon. The coupon can either be pre-generated and displayed or generated on the spot.