Hastymail2

Hastymail2 is an Open Source IMAP webmail client written in PHP. Our focus is compliance, usability, security, and speed.

Hastymail 2

avatar
Default email Address Settings

Just installed the latest SVN (as of today).  So far, everything seems to be working quite well.  Better than the clients I've tried so far.

In my config file, is set:

host_name =         (left empty for auto detection)

site_append_login_domain = mydomain.com

default_email_address = %u@mydomain.com

Logging in for the first time with just the userid and password (no @mydomain.com entered), the login works and I can access my email.

Checking the PROFILE page, I see that it assigned the following defaults:

Name: userid@mydomain.com

Email Address: userid@mydomain.com@mydomain.com

That default email address has an extra domain tacked on the end.  Where have I made my error?

Jim Craig

 

Reply /Quote
avatar
Re: Default email Address Settings

I don't think you have made an error, I think that you uncovered a bug with the default_email_address  logic specifically when the site_append_login_domain option is used. I will check into it and let you know what I find out.

Thanks for the feedback,
Jason

Reply /Quote
avatar
Re: Default email Address Settings

The following patch (which is now in SVN as of rev1368) should fix the problem:

 

Index: lib/url_action_class.php
===================================================================
--- lib/url_action_class.php    (revision 1364)
+++ lib/url_action_class.php    (working copy)
@@ -235,6 +235,11 @@
     if (isset($conf['user_defaults']['email_address'])) {
         $email = $conf['user_defaults']['email_address'];
         $email = trim(str_replace('%u', $_SESSION['user_data']['username'], $email));
+        $username = $_SESSION['user_data']['username'];
+        if (strpos($username, '@') !== false) {
+            $username = substr($username, 0, strpos($username, '@'));
+        }
+        $email = trim(str_replace('%u', $username, $email));
         if (isset($conf['percent_d_host']) && trim($conf['percent_d_host']) && strstr($email, '%d')) {
             $domain = $user->get_domain($conf['host_name'], $conf['percent_d_host']);
             $email = str_replace('%d', $domain, $email);

 

Thanks again for the feedback,
Jason

Reply /Quote
avatar
Re: Default email Address Settings

Sorry, that patch is missing a line. Try the following (or update via SVN to rev 1369 or newer)

 Index: lib/url_action_class.php
===================================================================
--- lib/url_action_class.php    (revision 1367)
+++ lib/url_action_class.php    (revision 1369)
@@ -234,7 +234,11 @@
     $email = false;
     if (isset($conf['user_defaults']['email_address'])) {
         $email = $conf['user_defaults']['email_address'];
-        $email = trim(str_replace('%u', $_SESSION['user_data']['username'], $email));
+        $username = $_SESSION['user_data']['username'];
+        if (strpos($username, '@') !== false) {
+            $username = substr($username, 0, strpos($username, '@'));
+        }
+        $email = trim(str_replace('%u', $username, $email));
         if (isset($conf['percent_d_host']) && trim($conf['percent_d_host']) && strstr($email, '%d')) {
             $domain = $user->get_domain($conf['host_name'], $conf['percent_d_host']);
             $email = str_replace('%d', $domain, $email);

Reply /Quote
avatar
Further Info Please

Jason,

Fast response.  Thanks.

However, I'm still getting my legs under me as far as PHP and such goes.  I didn't use SVN, but instead downloaded the tarball.

I'm not sure exactly how to apply the patch.

I can figure out it goes into the  lib/url_action_class.php file, and I think the code starts at line 234.  What I'm not 100% sure about is what parts or how much of the existing code to replace with the text shown above

Does this: @@ -234,7 +234,11 @@

mean:

Start at line 234 and delete 7 lines

then

Start at 234 and paste 11 lines?

Jim Craig

Reply /Quote
avatar
Re: Further Info Please

You can use the patch command to automatically apply a patch to source code. The numbers in the patch do refer to the location of the changes within the file, but the lines that begin with a "+" or "-" represent the lines to either be added or removed. The patch command does all this for you however. In this case you could copy the patch into a file called "changes.diff", then move it to the top level hastymail2 directory. Then you can apply the changes to the code with the following command:

patch -p0 < changes.diff

I did commit at least one other fix yesterday so if its not too much trouble I would recommend downloading the latest svn tarball and swapping out the code entirely. You won't have to reconfigure anything, simply replace the hastymail2 directory with the new download.

Jason

Reply /Quote
avatar
Latest SVN looks good

Finished updating to the latest SVN.

Looks like the problem with the email address is solved.

Good Job, Jason

 

Jim Craig

Reply /Quote
avatar
Re: Latest SVN looks good

Thanks for the follow up on this Jim. Sometimes a fix goes into the code but the original reporter disappears so I never really find out if it just "fixed it for me" or if it really did fix the bug.

Take care,
Jason

Reply /Quote
avatar
I'll be around

Jason,

I think I'll be sticking around for awhile.  Of all the "free" clients I've tested, I think I like this one the best. So, I'm determined to make it work, regardless of the problems I'm having getting everything right.

So, if it's ok with you, I'll make sure I keep the feedback current. That's how I pay back for the open source stuff I use.

Besides, I'm thinking I might want to contribute some more detailed documentation, particularly about  installation, based on my experiences with it.

Reply /Quote
avatar
Re: I'll be around

Jim,
   We appreciate all support offered to the project. Right now I am really the only developer but I try to keep up on suggestions and bug reports as much as possible. I plan on releasing the next candidate very soon (it is actually already uploaded to sourceforge so all I need to do now is all the announcing). It is the same as the latest SVN that you have been testing, so you don't have to bother with the upgrade. This will be the ninth candidate for a stable release and I really hope it is the last before we can finally have a stable branch. Any testing and feedback you can provide will greatly help toward that end, so thanks for offering to do so. After the RC9 release is complete I have at least the following issues to address before the next release:

- SMTP debugging option
- Better documentation and handling of the auto-assign special folders option
- Some minor translation changes (in English some phrases can be re-used in places but in other languages this does not always make sense)
- There seems to be a bug with outgoing mail not getting saved in the Sent folder when it has attachments over a certain size. Still troubleshooting it though.

Jason

Reply /Quote
Get Hastymail at SourceForge.net. Fast, secure and Free Open Source software downloads