Page 1 of 3

Could not instantiate mail function error (different from others)

Posted: Tue May 15, 2007 11:52 am
by Daniel Tulp
the Could not instantiate mail function has been reported several times:
http://forum.joomla.org/index.php/topic,136594.0.html
http://forum.joomla.org/index.php/topic,112718.0.html
http://forum.joomla.org/index.php/topic,167150.0.html
and more

always it is a matter of the mail settings

but with me the error occurs when the e-mail settings are on PHP mail function and Sendmail, that is different right?
I don't know what my SMTP user and pw is, or where I could create/ change that

The error happens when I add a new user through the user manager.

Server:
PHP built On:  Windows NT S011134 5.1 build 2600
Database Version: 5.0.21-community-nt
Database Collation: utf8_general_ci
PHP Version: 5.1.4
Web Server: Apache/2.0.55 (Win32) PHP/5.1.4
WebServer to PHP interface: apache2handler
Joomla! Version: Joomla! 1.5.0 Beta 2 [ Khepri ] 04-Oct-2007 00:00 GMT
User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

Re: Could not instantiate mail function error (different from others)

Posted: Tue May 15, 2007 3:53 pm
by Daniel Tulp
pvh123 wrote: Ok, Daniel.
Do a little test to rule out the email business.

Change the email settings in admin/server/configuration as email type: smtp
Do not set any passwords or whatever and choose:  "smtp.xs4all.nl" as your smtp host.

Then see what happens. If that also goes wrong, your problem is not the email configuration but something else of which I do not know the answer as yet.
well, first off, Send mail and PHP mail function, should work regardless of what SMTP does

second, entering this for the STMP gives "SMTP Error: Could not connect to SMTP host."

Re: Could not instantiate mail function error (different from others)

Posted: Tue Aug 21, 2007 8:34 pm
by Hackwar
Sendmail and PHP mail both require sendmail or PHP to be set up correctly, which is not really often the case. On the SMTP issue: Are you sure you inserted the correct data?

Is this issue confirmed?

Re: Could not instantiate mail function error (different from others)

Posted: Wed Aug 22, 2007 11:24 am
by Daniel Tulp
i'll try to reproduce today

Re: Could not instantiate mail function error (different from others)

Posted: Thu Aug 23, 2007 5:24 am
by tcp
You may get this message if the PHP function mail() has been disabled.  We just fixed a bug where the sendmail configuration was not being passed correctly to PHPMailer so this issue may be resolved, but please confirm.

tcp

Re: Could not instantiate mail function error (different from others)

Posted: Sat Sep 01, 2007 8:38 am
by Daniel Tulp
sorry for my late response, hope you weren't planning on having this in rc2

I Have installed RC2

With PHP Mail function, when adding a new user, it is created, but I still get the error 'Could not instantiate mail function.'

With Sendmail I get no error message (user is created)

With SMTP and host smtp.xs4all.nl (copied and pasted from this thread) I get 'SMTP Error: Could not connect to SMTP host.' (see attached screen capture, although the title says RC1, it is RC2) (user is created)

Here are some settings of my local that could be relevant (just normal WAMP server downloaded from http://www.wampserver.com):
Platform: Windows XP updated with latest microsoft updates
Joomla! Version:  Joomla! 1.5.0 Production/Stable [ Endeleo ] 1-September-2007 15:00 GMT
Safe Mode:  Off
Open basedir: None
Display Errors: On
Short Open Tags: Off
File Uploads: On
Magic Quotes: On
Register Globals: Off
Output Buffering: Off
Session Save Path: c:/wamp/tmp
Session Auto Start: 0
XML Enabled: Yes
Zlib Enabled: Yes
Disabled Functions: None
Mbstring Enabled: Yes
Iconv Available: Yes
WYSIWYG Editor: Editor - No Editor

sendmail_from no value no value
sendmail_path no value no value

SMTP localhost localhost
smtp_port 25 25

Internal Sendmail Support for Windows enabled
If you want to any other settings, let me know.

When I turn debug mode on I get the following debug information with SMTP:

Code: Select all

Application 0.065 afterLoad
Application 0.129 afterInitialise
Application 0.129 afterRoute
Application 0.268 afterDispatch
Application 0.386 afterRender
Memory Usage
17.884 kB
6 queries logged

   1.
      SELECT *
        FROM jos_session
        WHERE session_id = 'ba2680e44145ea1008b1f864c5e9102f'
   2.
      DELETE
        FROM jos_session
        WHERE ( time < 1188634497 )
   3.
      SELECT *
        FROM jos_session
        WHERE session_id = 'ba2680e44145ea1008b1f864c5e9102f'
   4.
      UPDATE jos_session
        SET `time`='1188635397',`userid`='62',`usertype`='Super Administrator',`username`='admin',`gid`='25',`guest`='0',`client_id`='1',`data`='__default|a:9:{s:15:\"session.counter\";i:31;s:19:\"session.timer.start\";i:1188634178;s:18:\"session.timer.last\";i:1188635369;s:17:\"session.timer.now\";i:1188635396;s:22:\"session.client.browser\";s:87:\"Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\";s:8:\"registry\";O:9:\"JRegistry\":3:{s:17:\"_defaultNameSpace\";s:7:\"session\";s:9:\"_registry\";a:2:{s:7:\"session\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}s:11:\"application\";a:1:{s:4:\"data\";O:8:\"stdClass\":1:{s:4:\"lang\";s:0:\"\";}}}s:7:\"_errors\";a:0:{}}s:4:\"user\";O:5:\"JUser\":19:{s:2:\"id\";s:2:\"62\";s:4:\"name\";s:13:\"Administrator\";s:8:\"username\";s:5:\"admin\";s:5:\"email\";s:18:\"mail@danieltulp.nl\";s:8:\"password\";s:65:\"c5afc48d82508934b079f0b1eb85d3cd:99UyxXieMU40K0zDhRDO0o0vRMbOQ7vL\";s:14:\"password_clear\";s:0:\"\";s:8:\"usertype\";s:19:\"Super Administrator\";s:5:\"block\";s:1:\"0\";s:9:\"sendEmail\";s:1:\"1\";s:3:\"gid\";s:2:\"25\";s:12:\"registerDate\";s:19:\"2007-09-01 02:03:19\";s:13:\"lastvisitDate\";s:19:\"2007-09-01 02:10:40\";s:10:\"activation\";s:0:\"\";s:6:\"params\";s:0:\"\";s:3:\"aid\";i:2;s:5:\"guest\";i:0;s:7:\"_params\";O:10:\"JParameter\":7:{s:4:\"_raw\";s:0:\"\";s:4:\"_xml\";N;s:9:\"_elements\";a:0:{}s:12:\"_elementPath\";a:1:{i:0;s:64:\"C:\\wamp\\www\\Joomla-1.5RC\\libraries\\joomla\\html\\parameter\\element\";}s:17:\"_defaultNameSpace\";s:8:\"_default\";s:9:\"_registry\";a:1:{s:8:\"_default\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:9:\"_errorMsg\";N;s:7:\"_errors\";a:0:{}}s:13:\"session.token\";s:32:\"a0aba71b2185f54a4018f616d2f7ca68\";s:17:\"application.queue\";a:2:{i:0;a:2:{s:7:\"message\";s:43:\"SMTP Error: Could not connect to SMTP host.\";s:4:\"type\";s:6:\"notice\";}i:1;a:2:{s:7:\"message\";s:32:\"Successfully saved User: Daniel5\";s:4:\"type\";s:7:\"message\";}}}'
        WHERE session_id='ba2680e44145ea1008b1f864c5e9102f'
   5.
      SELECT *
        FROM jos_components
        WHERE parent = 0
   6.
      SELECT folder AS type, element AS name, params
        FROM jos_plugins
        WHERE published >= 1
        AND access <= 2
        ORDER BY ordering

Language Files Loaded
[...]
With PHPMailer:

Code: Select all

Application 0.068 afterLoad
Application 0.130 afterInitialise
Application 0.131 afterRoute
Application 0.246 afterDispatch
Application 0.370 afterRender
Memory Usage
17.868 kB
6 queries logged

   1.
      SELECT *
        FROM jos_session
        WHERE session_id = 'ba2680e44145ea1008b1f864c5e9102f'
   2.
      DELETE
        FROM jos_session
        WHERE ( time < 1188634708 )
   3.
      SELECT *
        FROM jos_session
        WHERE session_id = 'ba2680e44145ea1008b1f864c5e9102f'
   4.
      UPDATE jos_session
        SET `time`='1188635608',`userid`='62',`usertype`='Super Administrator',`username`='admin',`gid`='25',`guest`='0',`client_id`='1',`data`='__default|a:9:{s:15:\"session.counter\";i:47;s:19:\"session.timer.start\";i:1188634178;s:18:\"session.timer.last\";i:1188635589;s:17:\"session.timer.now\";i:1188635608;s:22:\"session.client.browser\";s:87:\"Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\";s:8:\"registry\";O:9:\"JRegistry\":3:{s:17:\"_defaultNameSpace\";s:7:\"session\";s:9:\"_registry\";a:2:{s:7:\"session\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}s:11:\"application\";a:1:{s:4:\"data\";O:8:\"stdClass\":1:{s:4:\"lang\";s:0:\"\";}}}s:7:\"_errors\";a:0:{}}s:4:\"user\";O:5:\"JUser\":19:{s:2:\"id\";s:2:\"62\";s:4:\"name\";s:13:\"Administrator\";s:8:\"username\";s:5:\"admin\";s:5:\"email\";s:18:\"mail@danieltulp.nl\";s:8:\"password\";s:65:\"c5afc48d82508934b079f0b1eb85d3cd:99UyxXieMU40K0zDhRDO0o0vRMbOQ7vL\";s:14:\"password_clear\";s:0:\"\";s:8:\"usertype\";s:19:\"Super Administrator\";s:5:\"block\";s:1:\"0\";s:9:\"sendEmail\";s:1:\"1\";s:3:\"gid\";s:2:\"25\";s:12:\"registerDate\";s:19:\"2007-09-01 02:03:19\";s:13:\"lastvisitDate\";s:19:\"2007-09-01 02:10:40\";s:10:\"activation\";s:0:\"\";s:6:\"params\";s:0:\"\";s:3:\"aid\";i:2;s:5:\"guest\";i:0;s:7:\"_params\";O:10:\"JParameter\":7:{s:4:\"_raw\";s:0:\"\";s:4:\"_xml\";N;s:9:\"_elements\";a:0:{}s:12:\"_elementPath\";a:1:{i:0;s:64:\"C:\\wamp\\www\\Joomla-1.5RC\\libraries\\joomla\\html\\parameter\\element\";}s:17:\"_defaultNameSpace\";s:8:\"_default\";s:9:\"_registry\";a:1:{s:8:\"_default\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:9:\"_errorMsg\";N;s:7:\"_errors\";a:0:{}}s:13:\"session.token\";s:32:\"a0aba71b2185f54a4018f616d2f7ca68\";s:17:\"application.queue\";a:2:{i:0;a:2:{s:7:\"message\";s:36:\"Could not instantiate mail function.\";s:4:\"type\";s:6:\"notice\";}i:1;a:2:{s:7:\"message\";s:32:\"Successfully saved User: Daniel7\";s:4:\"type\";s:7:\"message\";}}}'
        WHERE session_id='ba2680e44145ea1008b1f864c5e9102f'
   5.
      SELECT *
        FROM jos_components
        WHERE parent = 0
   6.
      SELECT folder AS type, element AS name, params
        FROM jos_plugins
        WHERE published >= 1
        AND access <= 2
        ORDER BY ordering

Language Files Loaded
[...]
Furthermore, I haven't received any e-mails with new user data, also not when I use sendmail, which doesn't produce an error

Re: Could not instantiate mail function error (different from others)

Posted: Tue Oct 23, 2007 12:28 pm
by tcp
Daniel, I just wanted to follow-up and ask if you have been successful in getting the mail system to work using RC3 or the most recent nightly builds?

tcp

Re: Could not instantiate mail function error (different from others)

Posted: Tue Dec 04, 2007 4:28 pm
by Storm@raider
Hi All,

I have the same problem with Daniel as he show in picture. I try to search and found this topic.

I use 1.5 RC3 with nightly build and set all SMTP setting already.

When I add new user it said "SMTP Error! Could not connect to SMTP host."

SMTP server is already set.

One thing that I also don't understand, why Joomla! try to send email to new user?

Re: Could not instantiate mail function error (different from others)

Posted: Thu Dec 27, 2007 2:06 am
by timothybright
Does anyone know if this issue has been resolved?  Because as far as I can work out I am having the same problems documented here, and I cannot resolve them. 

Except that emails are getting through despite the error messages.


p.s. Moderators are consistently referring to the correct settings in the global configuration and the php.ini - As far as I am aware these are all correct is there some way that I can confirm this.

Cheers
Tim

Re: Could not instantiate mail function error (different from others)

Posted: Thu Dec 27, 2007 8:19 am
by Daniel Tulp
i'll do a test with rc4 and the latest svn in the beginning of januari (or tonight ;) )

Re: Could not instantiate mail function error (different from others)

Posted: Thu Dec 27, 2007 10:23 am
by tcp
timothybright wrote:
p.s. Moderators are consistently referring to the correct settings in the global configuration and the php.ini - As far as I am aware these are all correct is there some way that I can confirm this.

Cheers
Tim
There are many reasons why you could get the 'SMTP Error: Could not connect to SMTP host.' message.  This specific message comes from line 567 of phpmailer.php ( J/libraries/phpmailer ), a well-known mailer program included in the standard Joomla distribution, and if you are getting this far then the problem is probably not a Joomla problem per se - more likely, there truly is a problem connecting to the SMTP host.

Every case is different, of course.  You may need to debug this section of the code to find the actual point of failure.

At this point I don't see any evidence that there is an Joomla-specific issue here, other than people are having trouble getting this to work.

Re: Could not instantiate mail function error (different from others)

Posted: Fri Dec 28, 2007 1:37 am
by timothybright
Thanks for your replies, thats all helpful stuff.  I'll keep working at it, and hopefully adress my issues.


Tim

Re: Could not instantiate mail function error (different from ot

Posted: Tue Sep 02, 2008 6:35 am
by hungryOrb
timothybright wrote:Thanks for your replies, thats all helpful stuff. I'll keep working at it, and hopefully adress my issues.


Tim
Hi, I had this problem, and a kind guy directed me to this thread, which was just a wall of text and critted me :(
So, I asked a friend who recommended sendmail and exim OVER postfix which is what I had installed. I apt'd and installed sendmail over postfix and voila.
GL, although I have a feeling your fix might not be so simple.

Re: Could not instantiate mail function error (different from ot

Posted: Fri Sep 12, 2008 5:20 pm
by chorkhee
hi i have this error message also but i do not kow what should i do. hope someone out there can guide me along =)

Re: Could not instantiate mail function error (different from ot

Posted: Tue Sep 16, 2008 2:22 am
by hungryOrb
chorkhee wrote:hi i have this error message also but i do not kow what should i do. hope someone out there can guide me along =)
It quite possibly means that your mail is not working properly. So if you set up the server consider installing a new mail. I installed 'sendmail' which replaced postfix, and worked like a charm. If you didn't set up your server, but pay for it, then you can contact the host to tell the situation, the exact error message, and what you think will solve the problem. ie, installing a different mail. Configuring the old is probably a fine solution too, but maybe longer.
Hope it goes well.

Re: Could not instantiate mail function error (different from ot

Posted: Mon Oct 13, 2008 5:35 am
by xpertx
edit phpmailer.php. no need hard work.

Re: Could not instantiate mail function error (different from ot

Posted: Sat Nov 29, 2008 12:12 pm
by rakeshg
Hello Guys i am facing same problem please reply me as soon as possible !!!!!!!!!!

Re: Could not instantiate mail function error (different from ot

Posted: Wed Dec 24, 2008 9:34 pm
by kgonyea
rakeshg wrote:Hello Guys i am facing same problem please reply me as soon as possible !!!!!!!!!!
Ran into this issue and finally figured out it was a hosting issue and this thread solved it for me, maybe it will help you too...

http://forum.joomla.org/viewtopic.php?f=431&t=272547

8)

Re: Could not instantiate mail function error (different from ot

Posted: Thu Dec 25, 2008 11:13 pm
by alkas2
hi guys, i am new with joomla, i installed it and when i try to register a user i receive this message



* Could not instantiate mail function.
* Could not instantiate mail function.

Message

* Your account has been created and an activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login.




i dont know in wich file i have to do changes, like the smtp host and the email that will send by ....

thx for replying me and i appreciate so much

Re: Could not instantiate mail function error (different from ot

Posted: Sun Dec 28, 2008 5:07 am
by temporaryadd08
try this:

1. download xampplite-win32-1.7.0.zip
2. download Joomla v1.5.8.zip
3. download SecureMail-Patch.zip
4. unzip xampplite-win32-1.7.0.zip
5. edit php.ini at xampplite\apache\bin\php.ini

;extension=php_openssl.dll

-to-

extension=php_openssl.dll

6. delete files and folders in xampplite\htdocs\
7. unzip Joomla v1.5.8.zip in xampplite\htdocs\
8. unzip SecureMail-Patch.zip in xampplite\htdocs\ ('Yes' to replace)
9. execute setup_xampp.bat in xampplite\
10. execute xampp-control.exe in xampplite\, then start Apache and MySql
11. open web browser, then goto http://localhost/
12. install joomla
13. delete the folder xampplite\htdocs\installation\
14. open web browser, then goto http://localhost/administrator/
15. enter administration login, then goto Global Configuration
16. select Server tab
17. change Mailer = SMTP Server
18. change Mail from = myadd@gmail.com
19. change SMTP Authentication = Yes
20. change SMTP Security = TLS
21. change SMTP Port = 465
22. change SMTP Username = myadd
23. change SMTP Password = mypwd
24. change SMTP Host = smtp.gmail.com
25. click Save
26. register in the front-end

SPECIAL NOTES:
-under windows xp environment
-gmail free account
-myadd must be replaced by your gmail username
-mypwd must be replaced by your gmail password

you must use gmail accounts for this setup. yahoo free accounts doesn't allow us to access there
smtp server. in registering, i think joomla connects first to your smtp server, from your
smtp server it sends the mail to other mail servers (such as yahoo or gmail) depending on the
email address that you specified to send you the activation letter.

Re: Could not instantiate mail function error (different from ot

Posted: Mon Jan 19, 2009 6:37 am
by jessiered
Oh My! Thank you so much! Now my problem is solved!
Really really great help from you guys! :)

Jessiered

Re: Could not instantiate mail function error (different from ot

Posted: Mon Jan 19, 2009 6:40 am
by jessiered
Hi All!

I Got a new problem! SMTP Error! Could not connect to SMTP host.

When I tried to sign up for another user and click register. This is what is said "SMTP Error! Could not connect to SMTP host."

Thanks in advance

Jessiered

Re: Could not instantiate mail function error (different from ot

Posted: Mon Jan 19, 2009 6:56 am
by jessiered
Hi!

I just wanted to add. With the configuration given above by temporary is it right that it only works on the Front - End but will not work on the back - end unless given authorization by the Admin of the site?
Am I right
Answers would be much appreciated.

Thanks in Advance!

Jessiered

Re: Could not instantiate mail function error (different from ot

Posted: Mon Jan 19, 2009 7:00 am
by jessiered
Hi!

I just wanted to add. With the configuration given above by temporary is it right that it only works on the Front - End but will not work on the back - end unless given authorization by the Admin of the site?
Am I right
Answers would be much appreciated.

Thanks in Advance!

Jessiered

Re: Could not instantiate mail function error (different from ot

Posted: Sat Jan 31, 2009 8:00 pm
by Shurick
I resoved this problem by changing default smtp port from 25 to 80 in ../libraries/phpmailer/smtp.php line 30. Ask you provider what is your outgoing port.

var $SMTP_PORT = 80;

And for PHP mailer I simply installed Joomla package in other foulder and created new DB, but in this case I have problems with installation some of modules :eek:

Re: Could not instantiate mail function error (different from ot

Posted: Sat Feb 21, 2009 12:27 pm
by alexwalker
This script works in FacileForms but not BreezingForms. Why not? It sends an email to the submitter once the form is received. Can anyone advise me? I get the cannot instantiate mail function error message. The email is not sent acknowledging receipt of the form. It works in FacileForms NOT Breezing Forms.

$from = ff_getSubmit('cf_name');
$this->sendMail(
$mosConfig_mailfrom, // email from name: as in config.php
$mosConfig_fromname, // email from addres: as in config.php
ff_getSubmit('cf_email'), // email address as filled in by visitor
'Email sent to XXXXXXXX',
'Dear '.$from.', your email has been sent to XXXXX.'.nl().nl().
'Your prescription request will be dealt with within 48 hours'.nl().nl().ff_getSubmit('cf_message').nl().nl().
'Please do not respond to this email as it is generated automatically.'
);

Re: Could not instantiate mail function error (different from ot

Posted: Tue Mar 03, 2009 4:16 pm
by murphle1965
Shurick wrote:I resoved this problem by changing default smtp port from 25 to 80 in ../libraries/phpmailer/smtp.php line 30. Ask you provider what is your outgoing port.

var $SMTP_PORT = 80;
This too resolved my mailer issue. All that time spent on it and it was the port >:(

Re: Could not instantiate mail function error (different from ot

Posted: Tue Mar 03, 2009 9:34 pm
by Shurick
murphle1965 wrote: This too resolved my mailer issue. All that time spent on it and it was the port >:(
Good to know that what I found helped to somebody :D

Re: Could not instantiate mail function error (different from ot

Posted: Sat Mar 07, 2009 9:37 am
by alexwalker
Changed to Port 80 from 25, but made no difference ! I have never had to change the port address before. It is only since moving to new Joomla 1.5.9 and BreezingForms. Any further ideas?

Re: Could not instantiate mail function error (different from ot

Posted: Sat Mar 07, 2009 3:18 pm
by murphle1965
Actually, ours was the opposite. We were on another port and changed to port 25. That took care of it.