there are some problems with that code in general, but you should add some error handling to help with debugging.
Personally I would dump pear mail and use swiftmailer library. Just a suggestion to make things a little easier for you. They also have some plugins that you might find helpful
swiftmailer.org
|