How to hack a module which has not API I am using the module Print for print/mail node's content. However, I have problems to send email. I want to hack the module, so it will use the PHP class PHPMailer instead, and will hard-code the sending of the email. Everythings works perfect, but the situation is that there is no API and I have hard-coded directly in the module, so when the module is upgraded, I will lost my coding. Is there any way of making a hook of the desired function so I will get the same working but will still be able to upgrade the module without problems? I will accept other solutions, but the question is more general (I maybe would need to do something similar with other modules which do not provide API in the future). Thanks!!!
Usually there are two situations: your hack may be useful for other users or your hack is very very custom and is not likely to be useful for other users.

In the second case you can go with arpitr answer.

If your hack can be useful for other users (like this case) you should open a new Feature request or bug issue in the module's issue queue where you can share your hack as patch to the module. This way:


Other people can evaluate and discuss your code and solution pointing out any mistakes or bugs you are not aware of, improving your changes.
Maintainers can commit your patch to the module so in next upgrade you don't lose your changes as changes are included in the new release.
Any ohter module's user can benefit from the new feature.


The drawbacks is that your code must fit the general usage of the module, so your feature should not break others module's functionalities or usages. This may imply more work but benefits are good enough.