Problems, need help? Have a tip or advice? Post it here.
20 posts Page 1 of 2
My webhost has php mail() disabled - their page on it is here: http://www.eukhost.com/kb/php-mail-function-disabled-on-shared-web-hosting/

I'm aware of threads telling me how to try to get mail sent from a page within my site - but what about mail from CouchCMS itself? An example is a password reset mail - if I try the 'forgotten password' route (as superuser), it says it's sent mail, but it hasn't.

I've set the config.php to use the alternative method, but still no mail....
This is a problem we deal every time with different settings on hosting company. Some are okay, some restrict send_mail and we need to use phpmailer and other smtp scripts.

The true solution would be to redefine couch function (not tag) send_mail and embed a phpmailer script there. This is very likely already resolved in upcoming version. If this issue still bothers you today && you happen to know a bit php, then look no further and go to /couch/functions.php and get your hands dirty to embed a smtp route (or whatever your hosting company offers to use).
removed
@trendoman: thanks for the reply.

I've found a suggested php class on the website of my host, placed that into a php file and included it in functions.php, then modified the send_mail function in functions.php to use this class to send mail. It's not working!

The error shown in an error box on the 'forgot password' page is simply 'E-Mail could not be sent'. I can't see where in the Couch system the text of this error is generated; is it produced when send_mail returns FALSE (and mail() would do if it was enabled but failed)?

If so it looks likely that the solution on the hosts' website isn't working, and I'll have to get help from them!

The version of Couch I have is v1.4.7 (build 20151124) - which I think is the latest. Is there any indication when an upcoming version solving this will be available?
@daldred, could you please post a link to the script you found?
Thanks.
I think phpMailer would be more reliable and robust solution.

Could you please do one thing? Try sending emails from the front-end as discussed in the following thread - viewtopic.php?p=16802#p16802

I know that is not what you want but that would confirm that phpMailer works for you.
Let me know how it goes and I'll try to integrate it into the $FUNCS->send_mail() function.
Hi KK

Thanks for your reply! Yes, PHPMailer is working for mail sent from within a page: I've just tried it.

OK, I'm attaching an addon that should make both <cms:send_mail> tag as well as the internal Couch mail function to begin using PHPMailer instead of PHP's native mail() function.

However before we install this addon, we need to make one change to your existing Couch installation (I'm assuming that you are using Couch v1.4.7 - if not you really should upgrade to it).

Attached to this post is a 'functions.zip'. Extracting it will yield a file named 'functions.php'.
Place this file within your installation's 'couch' folder (thus replacing an existing core file of the same name).

Note: This step is required only for the current v1.4.7. Next releases will have the changes already incorporated.

Ok, so with that done, we can now install the addon.

Installation:
Extract the attached 'phpmailer.zip' to get a folder named 'phpmailer'.
Place this folder within your installation's 'couch/addons' folder.

Now edit the kfunctions.php found in the 'couch/addons' folder (you might need to rename kfunctions.example.php to kfunctions.php) and add the following line to activate this addon -
Code: Select all
require_once( K_COUCH_DIR.'addons/phpmailer/phpmailer.php' );

Configuration:
Within the 'couch/addons/phpmailer' folder you'll find a file named 'config.example.php'.
Rename it to 'config.php'. Now edit it to add your GMail account's name and password in the following fields -
Code: Select all
$cfg['username'] = 'your_email@gmail.com';
$cfg['password'] = 'your_password';

And that should be it. Now both the <cms:send_mail> tag as well as the functions called internally by e.g. the forgot-password routines should begin using PHPMailer's SMTP method for sending emails.

Please try it out and let me know if this works as expected.
In case it does not, please get me temporary access to your setup to allow me troubleshoot.

Hope it helps.

Attachments

Hi KK

I think we're getting closer, but...

If I use the settings as provided, with my gmail credentials, I get an email from Google saying:
Hi
Someone just tried to sign in to your Google Account xxxxxxxx@gmail.com from an app that doesn't meet modern security standards.

...followed by a recommendation only to use GMail or another secure app, and the advice that gmail has stopped this attempt to log in.

I've also tried using the settings as shown in this: https://www.eukhost.com/forums/f38/conf ... all-18914/

I've used both 'localhost' and 'mail.xxxxxx.org', port 587 with TLS and port 465 with SSL, and I still get 'E-Mail could not be sent' from the password reset page. Using cms:send_mail still sends no email. but also shows no error messages.

Since gmail clearly gets the smtp request but doesn't like it!) it does look as though it's something in the settings for the smtp server on my hosting - shall I take it up with them, or is the gmail result unexpected, in which case there may be something else wrong?

Happy to pm you site credentials if you want them at this point.
20 posts Page 1 of 2