I WILL:
Provide you with a class and function. This way you will be able to re-use this function in any of your projects, at will.
I Will also provide detailed comments in the source code so that you can reuse it to customize to your need, with precise instruction where to change the different settings for your SMTP server.
After all, I do not want you to spend more money if you change your ISP or hosting provider.
Cheers!