On Sun, Dec 14, 2014 at 09:34:30PM +0400, Michael Wagner wrote:
> Unfortunately the email setup is scarcely documented only 
> in Bucardo so I don’t know what exactly am I missing.

Yes, that's unfortunate. Volunteers? We have a wiki. :)

> requires authentication via username and password

I made a quick patch for this and the port: please test it out. 
Note that it will require the Authen::SASL module. If you are 
not using SASL, let us know that too. :)

Patch is attached and also in the main repo as 
9289a22e202a8c4e76a26b9fe4a9d6aca7c4239a

-- 
Greg Sabino Mullane [email protected]
End Point Corporation
PGP Key: 0x14964AC8
diff --git a/Bucardo.pm b/Bucardo.pm
index ea4e357..b1e277b 100644
--- a/Bucardo.pm
+++ b/Bucardo.pm
@@ -10097,6 +10097,7 @@ sub send_mail {
 
     ## Where do we connect to?
     my $smtphost = $config{default_email_host} || 'localhost';
+    my $smtpport = $config{default_email_port} || 25;
 
     ## Send normal email
     ## Do not send it if the 'example.com' default value is still in place
@@ -10106,9 +10107,18 @@ sub send_mail {
         eval {
             my $smtp = Net::SMTP->new(
                 Host    => $smtphost,
+                Port    => $smtpport,
                 Hello   => $hostname,
                 Timeout => 15
                 );
+
+            if ($config{email_auth_user} and $config{email_auth_pass}) {
+                ## Requires Authen::SASL
+                my ($auser,$apass) = ($config{email_auth_user}, $config{email_auth_pass});
+                $self->glog("Attempting Net::SMTP::auth with user $auser", LOG_DEBUG);
+                $smtp->auth($auser, $apass);
+            }
+
             $smtp->mail($from);
             $smtp->to($arg->{to});
             $smtp->data();
diff --git a/bucardo.schema b/bucardo.schema
index 5db9056..636ab45 100644
--- a/bucardo.schema
+++ b/bucardo.schema
@@ -162,8 +162,11 @@ bucardo_vac|1|Do we want the automatic VAC daemon to run?
 default_email_from|[email protected]|Who the alert emails are sent as
 default_email_to|[email protected]|Who to send alert emails to
 default_email_host|localhost|Which host to send email through
+default_email_port|25|Which port to send email through
 default_conflict_strategy|bucardo_latest|Default conflict strategy for all syncs
 email_debug_file||File to save a copy of all outgoing emails to
+email_auth_user||User to use for email authentication via Net::SMTP
+email_auth_pass||Password to use for email authentication via Net::SMTP
 flatfile_dir|.|Directory to store the flatfile output inside of
 host_safety_check||Regex to make sure we don't accidentally run where we should not
 isolation_level|repeatable read|Default isolation level: can be serializable or repeatable read

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Bucardo-general mailing list
[email protected]
https://mail.endcrypt.com/mailman/listinfo/bucardo-general

Reply via email to