Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3993 Failed to save mail sending options

1.560
closed-fixed
Jamie Cameron
5
2011-09-23
2011-09-23
Daniel Griswold
No

Failed to save mail sending options : Missing or un-resolvable SMTP server hostname error when trying to set "Send email using" to "Via SMTP to remote mail server". Cannot set Hostname, FQDN, or IP Address without generating this error.

When a hostname is entered, packet captures show a successful DNS Query and Response for the hostname appended with the search domain specified in /etc/resolv.conf.
When a FQDN is entered, packet captures show a successful DNS Query and Response for the SMTP server specified.
When an IP is entered, packet captures do not show any DNS Queries.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.3 LTS
Release: 10.04
Codename: lucid

dpkg -l |grep webmin
ii webmin 1.560 web-based administration interface for Unix

dpkg -l |grep perl-modules
ii perl-modules 5.10.1-8ubuntu2.1 Core Perl modules

Discussion

  • I made a small tweak and mine is working:

    --- save_sendmail.cgi.bak 2011-09-22 23:45:50.000000000 -0400
    +++ save_sendmail.cgi 2011-09-22 23:48:56.000000000 -0400
    @@ -16,7 +16,7 @@
    $mconfig{'send_mode'} = '127.0.0.1';
    }
    else {
    - &to_ipaddress($in{'smtp'}) && &to_ip6address($in{'smtp'}) ||
    + (&to_ipaddress($in{'smtp'}) || &to_ip6address($in{'smtp'})) ||
    &error($text{'sendmail_esmtp'});
    $mconfig{'send_mode'} = $in{'smtp'};
    }

     
  • Jamie Cameron
    Jamie Cameron
    2011-09-23

    Thanks .. this will be fixed in the next Webmin release.

    Actually, it is already fixed in the 1.564 development version, available from http://www.webmin.com/devel.html

     
  • Jamie Cameron
    Jamie Cameron
    2011-09-23

    • status: open --> closed-fixed
     
  • fade2gray
    fade2gray
    2011-12-07

    Virtualmin 3.88 gpl / Webmin

    While I find linux203's tweak permits options to be changed and saved without error, I find that the default 'From address for email from Webmin' is still used if an alternate address is entered.

     
  • fade2gray
    fade2gray
    2011-12-07

    That should read Virtualmin 3.88 gpl / Webmin 1.570

     
  • Jamie Cameron
    Jamie Cameron
    2011-12-07

    Webmin 1.580 will fix this ..

     
  • Giacomo
    Giacomo
    2011-12-21

    Hi,

    could you explain in details how to solve the problem?
    I have to modify the sendmail.cgi file?
    I'm quite beginner about bug solving! :)

    Thank you!

     
  • fade2gray
    fade2gray
    2011-12-21

    @ giactrov

    Open /usr/share/webmin/webmin/save_sendmail.cgi in text editor.

    Find at line number 19
    <code>&to_ipaddress($in{'smtp'}) && &to_ip6address($in{'smtp'}) ||</code>
    Change to
    <code>(&to_ipaddress($in{'smtp'}) || &to_ip6address($in{'smtp'})) ||</code>

     
  • Jamie Cameron
    Jamie Cameron
    2011-12-22

    Alternately, you can download the 1.573 development version of Webmin from http://www.webmin.com/devel.html

     
  • dgcom
    dgcom
    2012-03-20

    I just got the same issue in 1.580 - this is NOT fixed there.

     
  • Jamie Cameron
    Jamie Cameron
    2012-03-20

    dgcom - are you sure you are entering an SMTP server hostname that can be resolved on the Webmin system?

     
  • dgcom
    dgcom
    2012-03-20

    > are you sure you are entering an SMTP server hostname that can be
    resolved on the Webmin system?

    Absolutely! And I had to manually edit save_sendmail.cgi as per first comment to fix the problem (and verified the same in source).
    The bug is that logic requires resolving _both_ IPv4 and IPv6 for the SMTP host, which won't be true in most cases.

     
  • Jamie Cameron
    Jamie Cameron
    2012-03-21

    Ok, that IPv4 and v6 check is the cause - I'll fix this in the next Webmin release.

     
  • dgcom
    dgcom
    2012-03-21

    Ok, great thanks! I'll watch this and 3453581 and will test when 1.590 will come out.

     
  • jingo_man
    jingo_man
    2012-06-23

    I am having the same problems here too.

    Running Webmin 1.580. Edited the /usr/share/webmin/webmin/save_sendmail.cgi file, removing the " &&" part from the line and restarted the Webmin process.

    From an SSH session on the server, I am able to successfully resolve the smtp hostname I am entering, so I don't think there should be any issue.

    Any ideas to allow me to set this?

    Thanks

     
  • Jamie Cameron
    Jamie Cameron
    2012-06-24

    @jingo_man - could you post that block of code after you modified it?

    Or alternately, download the latest development version of Webmin from http://www.webmin.com/devel.html

     
  • jingo_man
    jingo_man
    2012-06-24

    @jcameron

    the contents, as requested:

    #!/usr/bin/perl
    # Save mail server settings

    require './webmin-lib.pl';
    &ReadParse();
    &error_setup($text{'sendmail_err'});
    &foreign_require("mailboxes");
    &lock_file($mailboxes::module_config_file);
    %mconfig = &foreign_config("mailboxes");

    # Save smtp server
    if ($in{'mode'} == 0) {
    delete($mconfig{'send_mode'});
    }
    elsif ($in{'mode'} == 1) {
    $mconfig{'send_mode'} = '127.0.0.1';
    }
    else {
    &to_ipaddress($in{'smtp'}) &to_ip6address($in{'smtp'}) ||
    &error($text{'sendmail_esmtp'});
    $mconfig{'send_mode'} = $in{'smtp'};
    }

    # Save login and password
    if ($in{'login_def'}) {
    delete($mconfig{'smtp_user'});
    delete($mconfig{'smtp_pass'});
    }
    else {
    $in{'login_user'} =~ /^\S+$/ || &error($text{'sendmail_elogin'});
    eval "use Authen::SASL";
    if ($@) {
    # Perl module missing
    &error(&text('sendmail_esasl',
    "/cpan/download.cgi?source=3&cpan=Authen::SASL&".
    "mode=2&return=/$module_name/&returndesc=".
    &urlize($text{'index_return'}),
    "Authen::SASL"));
    }
    $mconfig{'smtp_user'} = $in{'login_user'};
    $mconfig{'smtp_pass'} = $in{'login_pass'};
    }

    # Save auth method
    $mconfig{'smtp_auth'} = $in{'auth'};

    # Save from address
    if ($in{'from_def'}) {
    delete($mconfig{'webmin_addr'});
    }
    else {
    $in{'from'} =~ /^\S+\@\S+$/ || &error($text{'sendmail_efrom'});
    $mconfig{'webmin_addr'} = $in{'from'};
    }

    &save_module_config(\%mconfig, "mailboxes");
    &unlock_file($mailboxes::module_config_file);
    &webmin_log("sendmail");
    &redirect("");

     
  • Jamie Cameron
    Jamie Cameron
    2012-06-25

    You need to change the line :

    &to_ipaddress($in{'smtp'}) &to_ip6address($in{'smtp'}) ||

    to :

    &to_ipaddress($in{'smtp'}) || &to_ip6address($in{'smtp'}) ||