Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-08-17 17:31:15

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Emailing passwords

I have just installed textpattern on a new site and my passwords/user changes have not being emailed to me. Now i have managed to get in by using myphpadmin and overwriting the password. But i can’t get user details emailed to me.
What could be the problem?
Hope you can help me out…
Regards
Chris

Offline

#2 2008-08-17 20:37:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: Emailing passwords

Maybe this FAQ can help you.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2008-08-17 21:39:27

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Emailing passwords

Think this one is better for what you need…??

Offline

#4 2008-08-18 00:28:23

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

The first response was more relevant – i have contacted the hosting company to see if they can suggest anything
Its strange how it worked when i installed textpattern approximately 1 year ago on one domain with this hoster and not this time :s

Offline

#5 2008-08-18 18:02:09

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

Looking in the diagnostic i have an error message in the pre flight check

“Pre-flight check
The following PHP functions (which may be necessary to run Textpattern) are disabled on your server: set_time_limit”

Would this be relevant? Why would this be disabled? Its not on my other domain hosted by the same people?

Offline

#6 2008-08-18 18:57:09

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Emailing passwords

Not a problem. That setting limits the time a PHP script is allowed to run. Typically, if you exceed that limit, you should fix the problem (increase execution speed), not raise the limit ;)

Offline

#7 2008-08-18 21:26:25

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

Ok so thats not the problem
Have you any suggestions on what is or how it can be resolved?
CM

Offline

#8 2008-08-18 23:53:25

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Emailing passwords

Please post your diagnostics.

Offline

#9 2008-08-19 04:07:10

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Emailing passwords

Hello Chris,

I think you might also usefully check with your hosting company again and ask them if they have introduced constraints on php mail(), TXP uses it to power the passwords and username email module as do all the TXP plug-ins with an email component such as zem_contact, ing_password and so on. See Nora Brown’s and my posts which indicate the problem. There are sprinkling of other posts spread across the forum that highlight a similar issue. An increasing number of hosting companies require that a fifth php mail() parameter, the ‘from address’, be specified in the sendmail() function with an ‘-f’ switch to generate a full email header. It is an anti spam measure and likely will be increasingly adopted.

On the wider point, some hosts don’t allow the use of php sendmail() at all, requiring that all email generated on a web site go out via SMTP. Wordpress, Joomla, Expression Engine and Drupal are amongst other CMS that provide either an SMTP module or SMTP plug-in which circumvents the “-f fifth parameter” and no php sendmail() situations. I think that TXP may be behind the power curve in this respect. Can’t tell you how much it hurts to suggest that.

Last edited by joebaich (2008-08-19 10:41:19)

Offline

#10 2008-08-19 06:03:55

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

Rudd,
High Diagnostic:

Textpattern version: 4.0.6 (r2805)
Last Update: 2008-08-17 17:14:14/2008-08-17 09:13:58
Document root: /home/fhlinux143/f/friendsofudayan.co.uk/user/htdocs
$path_to_site: /home/fhlinux143/f/friendsofudayan.co.uk/user/htdocs
Textpattern path: /home/fhlinux143/f/friendsofudayan.co.uk/user/htdocs/textpattern
Permanent link mode: section_title
Temporary directory path: /home/fhlinux143/f/friendsofudayan.co.uk/user/htdocs/textpattern/tmp
Site URL: www.friendsofudayan.co.uk
PHP version: 5.2.6
GD Image Library: bundled (2.0.34 compatible); supported formats: GIF, JPG, PNG.
Server Local Time: 2008-08-19 07:03:16
MySQL: 5.0.22
Locale: en_GB.UTF-8
Server: Apache/1.3.41
PHP Server API: cgi-fcgi
RFC 2616 headers: 0
Server OS: Linux 2.6.18-92.1.10.el5PAE

Pre-flight check:
————————————
The following PHP functions (which may be necessary to run Textpattern) are disabled on your server: set_time_limit
————————————

.htaccess file contents:
————————————
#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes

<IfModule mod_rewrite.c> RewriteEngine On #RewriteBase /relative/web/path/

RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php

RewriteCond %{HTTP:Authorization} !^$ RewriteRule .* – [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

————————————

Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: latin1
character_set_filesystem: binary
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
17 Tables: OK

PHP extensions: libxml, xml, wddx, tokenizer/0.1, sysvshm, sysvsem, sysvmsg, session, pcre, SimpleXML/0.1, sockets, SPL/0.2, shmop, standard/5.2.6, Reflection/0.1, pspell, posix, pcntl, mime_magic/0.1, json/1.2.1, iconv, hash/1.0, gmp, gettext, ftp, filter/0.11.0, exif/1.4 $Id: exif.c,v 1.173.2.5.2.25 2008/03/12 17:33:14 iliaa Exp $, date/5.2.6, curl, ctype, calendar, bz2, zlib/1.1, openssl, cgi-fcgi, bcmath, dba, dom/20031129, gd, imap, ldap, mbstring, mysql/1.0, mysqli/0.1, ncurses, PDO/1.0.4dev, pdo_mysql/1.0.2, pdo_sqlite/1.0.1, snmp, soap, xmlreader/0.1, xmlrpc/0.51, xmlwriter/0.1, xsl/0.1, ionCube Loader, Zend Optimizer

/../index.php: r2774 (66519e6f500fa0e59fa27567e97d3675)
/css.php: r2772 (4807cbc15661213f2b4d0fd26c7179ff)
/include/txp_admin.php: r2729 (0c2b3cf59ff433c943bcc293a526651a)
/include/txp_article.php: r2680 (49a7155d831f843bcf3e8de306dfe7f1)
/include/txp_auth.php: r2728 (c472bfbe49a71fd35e89000c8a18de08)
/include/txp_category.php: r2243 (0ed99b6f44b5d221bdf35674240141ab)
/include/txp_css.php: r2730 (7974aa87728b39d3afaba5a3b18cf6b5)
/include/txp_diag.php: r2791 (aeb96445180b68c31821e237b6150332)
/include/txp_discuss.php: r2774 (852a8a4d4307358e161e0501124b7247)
/include/txp_file.php: r2530 (9f34fdbf98b9b649d65e2ced4c9ca763)
/include/txp_form.php: r1913 (780340d28f384113c72924843194b43e)
/include/txp_image.php: r2668 (11269b464db6cfa3affff47674533a50)
/include/txp_import.php: r1238 (86f0e64d2c9362066e6c48b9cd486e37)
/include/txp_link.php: r2463 (2379d25f83b37ec6c8d5f3edb1122ce8)
/include/txp_list.php: r2725 (1ed6c6f729eaeb7f8a582b27cd5b9e78)
/include/txp_log.php: r2796 (f249e0962a996f05041b899fea91ccae)
/include/txp_page.php: r2717 (807ff04b4a649b54b3d710c1ab0a428f)
/include/txp_plugin.php: r2774 (e9fdc47a3ed9bdd13197d929161c6a13)
/include/txp_prefs.php: r2528 (50bd3be8c22e17d5ca2855ccea081bac)
/include/txp_preview.php: r1238 (c45992b3273ac8019477e2f959d63120)
/include/txp_section.php: r2759 (9208297e0bd7b3d41bd0e6f9fc9ab120)
/include/txp_tag.php: r2774 (f371b400e8d7318e2ac48e032fe6c274)
/index.php: r2805 (ee8ab2e3c4bc9abd77aa7384ecba5268)
/lib/IXRClass.php: r765 (0120eb4713c9b6446a0eebe8b1039d1c)
/lib/admin_config.php: r1747 (b972529744cb37a7695fe00316dada41)
/lib/class.thumb.php: r2329 (c7f66a32531f32d6dfcbe5c7d26c7852)
/lib/classTextile.php: r2779 (b6d5b9cecbc5bc6475b5d1ee6a5231ea)
/lib/constants.php: r2361 (5338211ece1b2592804acdd204c9df33)
/lib/taglib.php: r2612 (727737ebd08127c632b9822bae87fee0)
/lib/txplib_admin.php: r2726 (c4f65bac2ddef62867f5bfee97ad7dfe)
/lib/txplib_db.php: r2748 (3feb369b1c34f251815cd6085a216d62)
/lib/txplib_forms.php: r2759 (a2d3de62110e582fab2a3a20224661f4)
/lib/txplib_head.php: r2783 (74ced647523a94da307af9853d7ed596)
/lib/txplib_html.php: r2696 (57985ebd2501bc303d2e97ae7538db1f)
/lib/txplib_misc.php: r2788 (7ecfaa5d4fabefbf411d01615dea9485)
/lib/txplib_update.php: r1239 (e3bd2d0c2b491d4028a656b8301a0086)
/lib/txplib_wrapper.php: r2800 (4ad38ee67f3ee8d9e7b51544a4f0f58b)
/publish.php: r2777 (0ce3da212329e7d34de07e53e109d182)
/publish/atom.php: r2774 (50aa384a2edf7cc07effee9020e0893b)
/publish/comment.php: r2776 (0e1ea64316087edcd75f394494b42100)
/publish/log.php: r1637 (f69237dc2ff39bd7a691c8ca1bc87808)
/publish/rss.php: r2793 (022caa22c756c64f2255aae6625686d8)
/publish/search.php: r1748 (ea84e04b2c688b0bb8b5a9ecf395749a)
/publish/taghandlers.php: r2774 (59dc36e6dabc619e23c43f722fe7b8f1)
/update/_to_1.0.0.php: r711 (0f49fca8fbd8e6fca0fc48b0f69f0461)
/update/_to_4.0.2.php: r711 (e77c0e0d972868f19eaee4565bd0b4c4)
/update/_to_4.0.3.php: r711 (f5506cfd0fbc3ad4bd9a9b2299468775)
/update/_to_4.0.4.php: r711 (4d867b42ee87a7f11d2bff3a8e91bed0)
/update/_to_4.0.5.php: r2464 (dbe80cd4a775d3a43a203c3c4a2d0e3f)
/update/_to_4.0.6.php: r2464 (7e5ae73eb64c24438918697089a1f321)
/update/_update.php: r2792 (6ff7b4dedb2c7735a01e76b13b3f1fb1)

Offline

#11 2008-08-19 06:10:58

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

Have asked the hosting company regarding their policy and if they have made any changes to php mail (). Is there any chance of being able to add a ‘-f’ switch? Can it not be encorporated into txp to enure this is not a problem?

Offline

#12 2008-08-19 06:14:04

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

as i was responding to all these queries my hosting company has informed me:

“This issue is occuring because there is a missing fifth parameter in your mail script. This has always been a requirement of mail scripts on our shared hosting platform but recent updates to our Linux servers (from PHP4 to PHP5) has meant that this is now always required.”

I believe its possible to make a script? so fingers crossed!!!

Offline

#13 2008-08-19 10:05:18

manncj
Member
From: Buckinghamshire, England
Registered: 2007-10-23
Posts: 48
Website

Re: Emailing passwords

i have spoken to the hosters and they have forwarded me an artice on how to edit the send mail script:

endmail Functions
What is the path to Sendmail?

/usr/sbin/sendmail

How do I use Sendmail in a script?

When using sendmail you will need to ensure that you use an active POP3 mailbox on your domain in either the to or from field in the mail script.

An example of how to use this is displayed below:

mail($to, $sub, $mess, “From: root@yourdomain.co.uk”, “-froot@yourdomain.co.uk”);

Please can someone identify which file i need to add this script into etc.

Regards
Chris

Offline

#14 2008-08-19 12:04:32

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Emailing passwords

Please can someone identify which file i need to add this script into etc.

Edit txpMail function (on line 929) in textpattern/lib/txplib_misc.php. Change line 988 to use that required flag.

In example from $sep to $sep,'-f'.$email (or use address directly instead variable).

Note that the user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a ‘X-Warning’ header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

Last edited by Gocom (2008-08-19 12:08:05)

Offline

#15 2008-08-19 12:07:23

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Emailing passwords

Hello Chris,

It’s an absolute b****r isn’t it! As far as we can tell, it isn’t possible to append code to one’s .htaccess file or to Textpattern’s config.php file to make the necessary changes to email headers generated by php mail(), which would be relatively painless. The php snippet:

php_value mail.force_extra_parameters -fsender@domain.com 

where sender@domain.com is a valid email address, used to be the way to achieve this but updates to PHP5.2.5 last year ensure that the “mail.force_extra_parameters” php.ini directive is no longer to be modifiable in .htaccess due to the security implications.

We aren’t programmers and will only dabble in PHP in life threatening situations. Nevertheless, this is what we we had to do to get ourselves out of the bind that you now find yourself in when our host introduced the same measures a month or two ago, effectively crippling a clutch of our sites. We hacked at one of the TXP core files and a handful of key TXP plug-ins to make them work under the amended requirements.

To deal with TXP’s password/username email system by adding the -f switch along with the user email address stored in the txp_prefs mySQL table, we amended the PHP module in textpattern/lib/txplib_misc.php (TXP 4.0.6) as follows:

CHANGE:

981            return mail($to_address, $subject, $body,

982

983                        "From: $RealName <$email>".

984                        $sep.'Reply-To: '.( isset($reply_to) ? $reply_to : "$RealName <$email>" ).

985                        $sep.'X-Mailer: Textpattern'.

986                        $sep.'Content-Transfer-Encoding: 8bit'.

987                        $sep.'Content-Type: text/plain; charset="'.$charset.'"'.

988                        $sep

989            );

990  }

TO:

981            $sender_email = safe_field("val",'txp_prefs',"name = 'blog_mail_uid'");

982            $sender_email = strip_rn($sender_email);

983                                   

984            return mail($to_address, $subject, $body,

985                        "From: $RealName <$sender_email>".

986                        $sep.'Reply-To: '.( isset($reply_to) ? $reply_to : "$RealName <$sender_email>" ).

987                        $sep.'X-Mailer: Textpattern'.

988                        $sep.'Content-Transfer-Encoding: 8bit'.

989                        $sep.'Content-Type: text/plain; charset="'.$charset.'"'.

990                        $sep,

991                        "-f<$sender_email>"

992            );

993  }

This seems to work well but we readily admit that it’s an amateurish hack and that there are likely better and more elegant ways to achieve the same result. It would be good if the devs would take this up sooner than later, I feel, because there is something of a tidal surge as more hosting companies adopt this requirement. We tested our hack with TXP installations on some hosting companies that don’t have the requirement (yet) and it worked fine on those too, so it seems that “-froot@yourdomain.co.uk” is backwards compatible as a concept and probably something to be considered for adding to the TXP core.

As for the key plug-ins:
  • ign_password_protect responds to a hack that is almost identical to the one above.
  • for zem_contact_reborn, see Nora Brown’s post. We find that it works well, except that we have a question about whether the amendment covers the copy of the email generated by the form that is destined for the email’s originator. We have had some instances of it behaving differently but haven’t been able to diagnose why yet.

I will find someplace to lodge copies of the hacked txplib_misc.php file and the ign_password_protect plug_in so that they can be downloaded for convenience sake. I’ll post details later on today but need to go and feed some hungry and insistent dogs for now.

Apologies if I have banged on too much here but it’s an issue, along with the need for a SMTP alternative to PHP mail() that seems as if it won’t go away.

I hope this gets you out of your current difficulty for now.

Last edited by joebaich (2008-08-19 12:09:49)

Offline

Board footer

Powered by FluxBB