Results 1 to 9 of 9

Thread: Notification emails - 127.0.0.1 change to...

  1. #1
    mberrisford is offline Member
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    5

    Default Notification emails - 127.0.0.1 change to...

    Greetings,

    Whenever a notification email is sent by sugar my server is localhost and not the sugar server name.

    For instance:
    ...
    You may review this Account at:
    http://127.0.0.1:1986/sugarcrm/index.php?module=Accounts&action=DetailView&record =2f71bf55-6ab5-6783-3e3e-4ac6034b9caa>

    I would like this to read:
    You may review this Account at:
    http://sugar:1986/sugarcrm/index.php?module=Accounts&action=DetailView&record =2f71bf55-6ab5-6783-3e3e-4ac6034b9caa>

    Could someone point me in the right direction?

    Thanks,
    Martin

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    5,205

    Default Re: Notification emails - 127.0.0.1 change to...

    You can adjust it by changing the site_url setting in your config.php file
    Regards,

    Angel Magaņa
    Technical Solutions Architect
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

  3. #3
    mberrisford is offline Member
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    5

    Default Re: Notification emails - 127.0.0.1 change to...

    Worked like a charm. Thanks for the assist!

  4. #4
    analyst123 is offline Member
    Join Date
    Jun 2009
    Posts
    17

    Default Re: Notification emails - 127.0.0.1 change to...

    it doesn't work!
    config.php modification is not the solution.

    Also I've searched in all threads and it seems there is no answers for this question.

    What code has to be modified to force notification url ?

    I have users that are accessing to the crm from an internal IP while all other users are connecting from an external IP.

    So all email notifications sent from the first group have http://<internalIP> url

    tks a lot for your help

    SUGAR CE 5.2

  5. #5
    analyst123 is offline Member
    Join Date
    Jun 2009
    Posts
    17

    Default Re: Notification emails - 127.0.0.1 change to...

    here the solution:

    you have to edit \data\SugarBean.php

    change the following string from
    $httpHost = $_SERVER['HTTP_HOST'];

    to
    $httpHost = "yourdomain.com";

  6. #6
    kismert is offline Member
    Join Date
    Oct 2010
    Posts
    5

    Default Re: Notification emails - 127.0.0.1 change to...

    Password notifications behave differently:

    The 'New account information' notification email does not respect the site_url setting that angel suggested. Instead you have to modify the email_templates table directly. See the thread "Trouble With Password Reset Email Template".

    The 'Reset your account password' notification email does respect the site_url.

    Both password notifications do not appear to be affected by \data\SugarBean.php, as analyst123 had suggested.

    @analyst123:
    I looked at \data\SugarBean.php, and I think that the modification you suggested is kind of risky. Here is my reasoning:
    • If $_SERVER['HTTP_HOST'] is broken, it is best to try to fix the source problem in your PHP or web server configuration.
    • You have introduced a hard-to-find problem should you ever move this code to a new server.


    -Ken
    Last edited by kismert; 2010-10-29 at 12:48 AM.

  7. #7
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    5,205

    Default Re: Notification emails - 127.0.0.1 change to...

    The issue with the password reset is a bug. There is no logical reason for it to not use site_url. I filed it a few weeks ago and it is supposed to be fixed in an upcoming patch.

    See here for bug # and other info:
    http://www.sugarcrm.com/forums/showthread.php?t=64551
    Regards,

    Angel Magaņa
    Technical Solutions Architect
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

  8. #8
    kismert is offline Member
    Join Date
    Oct 2010
    Posts
    5

    Default Re: Notification emails - 127.0.0.1 change to...

    @Angel:
    I reviewed Bug# 39601, and I completely agree with you. However, I couldn't find my issue on the bug site.

    My issue, in version 6.0.2, is also partly in GeneratePassword.php, but in the the 'generatepasswordtmpl' path, not the 'lostpasswordtmpl' path that your bug pertains to.

    Steps to reproduce:
    • User sets site_url incorrectly upon installation
    • \install\seed_data\Advanced_Password_SeedData.php creates a 'New account information' record in the email_templates table with the wrong site_url
    • User corrects site_url
    • GeneratePassword.php fails to include the new site_url when generating a New account email


    Suggested fix:

    Advanced_Password_SeedData.php:
    PHP Code:
    // Line 46 -- change from:
    $body '<div><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width="550" align=\"\&quot;\&quot;center\&quot;\&quot;\"><tbody><tr><td colspan=\"2\"><p>Here is your account username and temporary password:</p><p>Username : $contact_user_user_name </p><p>Password : $contact_user_user_hash </p><br><p>'.$GLOBALS['sugar_config']['site_url'].'/index.php</p><br><p>After you log in using the above password, you may be required to reset the password to one of your own choice.</p>   </td>         </tr><tr><td colspan=\"2\"></td>         </tr> </tbody></table> </div>';
    // To:
    $body '<div><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width="550" align=\"\&quot;\&quot;center\&quot;\&quot;\"><tbody><tr><td colspan=\"2\"><p>Here is your account username and temporary password:</p><p>Username : $contact_user_user_name </p><p>Password : $contact_user_user_hash </p><br><p>$sugar_base_url</p><br><p>After you log in using the above password, you may be required to reset the password to one of your own choice.</p>   </td>         </tr><tr><td colspan=\"2\"></td>         </tr> </tbody></table> </div>';

    //Line 53 -- change from:
    '.$GLOBALS['sugar_config']['site_url'].'/index.php
    // to:
    $sugar_base_url 
    GeneratePassword.php:
    PHP Code:
    // Insert after Line 131:
    $baseUrl $sugar_config['site_url'] . '/index.php';

    // Line 135 -- change from:
    $url="http://".$GLOBALS['_SERVER']['HTTP_HOST'].$GLOBALS['_SERVER']['PHP_SELF']."?entryPoint=Changenewpassword&guid=$guid";
    // to:
    $url $baseUrl "?entryPoint=Changenewpassword&guid=$guid";

    // Insert after line 168:
    $htmlBody str_replace('$sugar_base_url'$baseUrl$htmlBody);
    $body str_replace('$sugar_base_url'$baseUrl$body); 
    This way, only a '$sugar_base_url' token gets placed into the generatepasswordtmpl record in email_templates, which is replaced with the current site_url in GeneratePassword.php.

    Then, all the user has to do is correct site_url in config.php, and all of the password notification emails will automatically get the proper link.

    Let me know what you think.

    -Ken

  9. #9
    equality4xy is offline Junior Member
    Join Date
    Nov 2010
    Posts
    1

    Default Re: Notification emails - 127.0.0.1 change to...

    I am having this exact issue. my issue is a private IP has been populated and it has not taken the corrected Site URL I have replaced it with in the config.php.

    I am using 6.0.3

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to change the email notification message
    By rijas in forum Developer Help
    Replies: 17
    Last Post: 2009-11-11, 03:51 AM
  2. Object change Notification using SOAP
    By pgiuseppe in forum Developer Help
    Replies: 4
    Last Post: 2006-09-26, 09:49 AM
  3. module change log email notification
    By ellerjefe in forum General Discussion
    Replies: 0
    Last Post: 2006-07-10, 08:15 PM
  4. Notification Emails
    By mamillar in forum General Discussion
    Replies: 1
    Last Post: 2006-04-08, 04:58 AM
  5. Replies: 1
    Last Post: 2005-05-24, 09:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •