Disable smtp for a client

Discussion in 'General' started by danypd69, Jun 25, 2012.

  1. danypd69

    danypd69 New Member

    Hello, I need to disable the possibility to use smtp to some clients;
    Is this possible? I saw that there is a "disablesmtp" field in the mail_user table but it seems that it's not used anywhere.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can disable smtp for a client by enabling the "Disablesmtp" field in the mailbox settings. This value is used by postfix and dovecot/courier.
     
  3. danypd69

    danypd69 New Member

    Do you mean in the web interface? I don't see any Disablesmtp field, only Disable POP3 and Disable IMAP
     

    Attached Files:

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You're right, the field is named "Enable receiving". Disable that checkbox to disable smtp.
     
  5. danypd69

    danypd69 New Member

    Ok I will try, but does it disable also smtp receiving? I need to disable the possibility to use my server to send mail only

    UPDATE: Tried it but also smtp receiving is disabled.

    Any pointer to disable only smtp out ?
     
    Last edited: Jun 25, 2012
  6. falko

    falko Super Moderator Howtoforge Staff

    I think you can use transports and route those emails to some non-existing account. See
    Code:
    man 5 transport
     
  7. danypd69

    danypd69 New Member

    Ok I will check it.
    Another idea that I had is to refuse authentication to selected usernames but I'm unable to understand fully how smtp authentication works in ISPConfig
     
  8. Dehumanizer

    Dehumanizer New Member

    Patch to implement this feature

    I wanted the same feature, i.e. disable SMTP for certain users but on the other hand don't disable receiving for that account (so it can receive mail).
    I have found that the code and data structures for doing that is already there, configuration for disabling and enabling of email receiving and smtp access are separate even in the database, just the frontent is done in a way that checking the "disable receiving" checkbox disables both these features at the same time, I'm not sure why it isn't split into "disable receiving" and "disable SMTP".

    So I made a little patch to split these features for ISPConfig 3.0.4.6, I'm attaching the patch file here.

    Instructions:
    1. save the file to /usr/local/ispconfig/interface/web/mail
    2. gunzip disablesmtp.patch.gz
    3. patch -p1 -i disablesmtp.patch
    4. go to your ISPConfig panel to the user mailbox settings, there should be a new checkbox "Disable SMTP" available.

    Notes:
    -disabling SMTP does not affect the ability to send email through webmail.
    -I have added the checkbox text just for english language, if you are using a different language, you need to add a line "$wb["disablesmtp_txt"] = 'Disable SMTP';" in the corresponding language file <lang>_mail_user.lng file in the /usr/local/ispconfig/interface/web/mail/lib/lang directory where <lang> is the language you want to edit. You can of course translate the "Disable SMTP" string to your language.
    If you don't do this and you are using a language other than english, the checkbox will still be there and will work, but will have no caption.

    Enjoy!
     

    Attached Files:

  9. danypd69

    danypd69 New Member

    Thanks, I will try it as soon as possible.
     
  10. bert

    bert New Member

  11. stemio77

    stemio77 New Member

    Hi, i tried to apply this patch to ISPConfig 3.0.5.1 and got an error:

    Hunk #1 succeeded at 257 with fuzz 2 (offset 8 lines).
    Hunk #2 succeeded at 298 with fuzz 2 (offset 8 lines).
    patching file templates/mail_user_mailbox_edit.htm
    Hunk #1 FAILED at 51.
    1 out of 1 hunk FAILED -- saving rejects to file templates/mail_user_mailbox_edit.htm.rej

    thnx for help..
     
  12. Dehumanizer

    Dehumanizer New Member

    Hello,

    I don't have time to update the patch right now, but here is the quick fix:
    Locate mail_user_mailbox_edit.htm file in your ispconfig installation (most likely it will be /usr/local/ispconfig/interface/web/mail/templates/mail_user_mailbox_edit.htm )
    then find lines that go like this:
    Code:
    <div class="ctrlHolder">
    
                    <p class="label">{tmpl_var name='disableimap_txt'}</p>
    
    and immediately before that div, put this:

    Code:
               <div class="ctrlHolder">
                                   <p class="label">{tmpl_var name='disablesmtp_txt'}</p>
                                           <div class="multiField">
                                                   {tmpl_var name='disablesmtp'}
                                           </div>
                           </div>
    
    and that should fix it. The "disable SMTP" checkbox should appear when you are editing a mailbox.
    Let me know if you have any problems with that.
     
  13. stemio77

    stemio77 New Member

    Hi Dehamanizer,
    thanks for your quick response.
    Please see the attach
     

    Attached Files:

  14. Dehumanizer

    Dehumanizer New Member

    Please attach your mail_user_mailbox_edit.htm file
     
  15. stemio77

    stemio77 New Member

    here my mail_user_mailbox_edit
     

    Attached Files:

  16. stemio77

    stemio77 New Member

    solved (but not tried yet) if SMTP work
    i've found 3 files .rej, in each of them were highlighted the changes that had not been made ​​to the main fileexample:

    en_mail_user.lng.rej
    $wb["disableimap_txt"] = 'Disable IMAP';
    + $wb["disablesmtp_txt"] = 'Disable SMTP';
    $wb["disablepop3_txt"] = 'Disable POP3';

    in
    mail_user.tform.php.rej
    + 'disablesmtp' => array (
    + 'datatype' => 'VARCHAR',
    + 'formtype' => 'CHECKBOX',
    + 'default' => 'n',
    + 'value' => array(1 => 'y',0 => 'n')
    + ),

    insert these codes in my en_mail_user.lng and mail_user.tform.php..

    now i'll try to see if works or not!!
     
    Last edited: Oct 11, 2013

Share This Page