***************
*** 47,53 ****
                'UNKNOWN' , '3');
  
  my $state = "UNKNOWN";
- my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
  my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
  my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
  $debug = 0;
--- 47,53 ----
                'UNKNOWN' , '3');
  
  my $state = "UNKNOWN";
+ my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned,$authuser,$authpasswd);
  my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
  my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
  $debug = 0;
***************
*** 89,94 ****
                         "pendcrit=i",\$pendcrit,
                         "maxmsg=i",\$maxmsg,
                         "keeporphaned=s",\$keeporphaned,
                         );
  usage() if ($status == 0 || ! ($pophost && $popuser && $poppasswd &&
         $smtphost && $receiver && $sender ));
--- 89,96 ----
                         "pendcrit=i",\$pendcrit,
                         "maxmsg=i",\$maxmsg,
                         "keeporphaned=s",\$keeporphaned,
+                        "authuser=s",\$authuser,
+                        "authpasswd=s",\$authpasswd,
                         );
  usage() if ($status == 0 || ! ($pophost && $popuser && $poppasswd &&
         $smtphost && $receiver && $sender ));
***************
*** 122,127 ****
  
  my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts) 
    || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
  ($smtp->mail($sender) &&
   $smtp->to($receiver) &&
   $smtp->data() &&
--- 124,132 ----
  
  my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts) 
    || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
+ if ($authuser && $authpasswd) {
+        $smtp->auth($authuser,$authpasswd) || nsexit("Error authenticating to SMTP server",'CRITICAL');
+ }
  ($smtp->mail($sender) &&
   $smtp->to($receiver) &&
   $smtp->data() &&
***************
*** 246,251 ****
    print        "   -passwd=text       Password for the POP3-user\n";
    print        "   -poptimeout=num    Timeout in seconds for the POP3-server\n";
    print "   -smtphost=text     IP oder name of the SMTP host\n";
    print "   -smtptimeout=num   Timeout in seconds for the SMTP-server\n";
    print "   -statfile=text     File to save ids of messages ($statfile)\n";
    print "   -interval=num      Time (in minutes) that must pass by before sending\n";
--- 251,258 ----
    print        "   -passwd=text       Password for the POP3-user\n";
    print        "   -poptimeout=num    Timeout in seconds for the POP3-server\n";
    print "   -smtphost=text     IP oder name of the SMTP host\n";
+   print "   -authuser=text     SMTP Auth username\n";
+   print "   -authpasswd=text   SMTP Auth passwd\n";
    print "   -smtptimeout=num   Timeout in seconds for the SMTP-server\n";
    print "   -statfile=text     File to save ids of messages ($statfile)\n";
    print "   -interval=num      Time (in minutes) that must pass by before sending\n";
