This work is licensed under a Creative Commons Attribution-Noncommercial 2.5 Australia License.
I recently spent a good number of hours trying to fix a mailer error in Joomla on a Windows server. I did not have access to php.ini and wasn't able to change any server variables. I kept getting the error:
Could not instantiate mail function.
I tried PHP Mail Function, Sendmail and SMTP in the Server section of Global Configuration but none seemed to work. A quick check of phpinfo (Help -> System -> PHP Information) revealed that Internal Sendmail Support for Windows was enabled.
I could get a basic PHP file using mail() working but when getting the system to send an email using the default phpmailer library I would get the error. This included m contact form, new user registration, mass mail etc. After searching and findng some similar problems with no real solutions, I did some tweaking and found an easy solution. You can fix it by following the steps below. Please note this is only tested for version 2.0.4 of the PHPmailer library in Joomla 1.5.15, on Apache (Win32).
Open /libraries/phpmailer/phpmailer.php and make the following changes to line 75 and 88:
Change the default $From variable on line 75:
* Sets the From email address for the message.
* @var string
var $From = '
Change the default $Sender variable on line 83:
* Sets the Sender email (Return-Path) of the message. If not empty,
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
* @var string
The From and Sender variables were blank and once set with a default value, mail should send without any more problems.