How can we hit/run the rules using code
Create first rule "After saving a new user account" action "Add user role" to user and set its priority first(by set its weight 0 in SETTINGS of rule) and create one another rule for the same and set condition for role is(Reffereal source) and action send a HTML mail, set its priority down (by set its weight 1 in SETTINGS of rule) will work for you.