Use custom mail attachment function
Fix compiler warnings