Error while authentication in Mailing Program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while authentication in Mailing Program
# 1  
Old 10-05-2009
Error while authentication in Mailing Program

Hi Experts,

I am using below Perl script to send mail through and Microsoft Exchange server.

Code:
#!/usr/bin/perl -w
use SendMail;

$smtpserver          = "exchange_server.com";
$smtpport            = 25;
$sender              = "ABC\@def.com";
$subject             = "TESTING SMTP Server";
$recipient           = "mymailid\@def.com";
$header              = "X-Mailer";
$headervalue         = "Perl SendMail Module 1.09";
$mailbodydata        = "This is a testing mail.";
$userid              = "ABC\@AAA.com";
$password            = "passwd";


$obj = new SendMail($smtpserver,$smtpport);
$obj->setDebug($obj->ON);
$obj->From($sender);
$obj->Subject($subject);
$obj->To($recipient);
$obj->setMailHeader($header, $headervalue);
$obj->setMailBody($mailbodydata);
$obj->setAuth($obj->AUTHLOGIN, $userid, $password);
#$obj->setAuth($obj->AUTHPLAIN, $userid, $password);

if ($obj->sendMail() != 0)
{
    print "Error in Sending Mail.\n";
    print $obj->{'error'}."\n";
    exit -1;
}
else
{
    print "Done\n\n";
    exit 0;
}


And I am getting below error

Code:
220 in-ex004.groupinfra.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Mon, 5 Oct 2009 11:40:52 +0530
EHLO mymachine.com
250-exchange_server.com Hello [111.222.3.1]
250-TURN
250-SIZE 20971520
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM
250-AUTH GSSAPI NTLM
250-X-LINK2STATE
250-XEXCH50
250 OK
AUTH LOGIN
Error in Sending Mail.
504 5.7.4 Unrecognized authentication type.


If I comment the setAuth() function i.e., below line
$obj->setAuth($obj->AUTHLOGIN, $userid, $password);

I am getting below error.
Code:
220 exchange_server.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Mon, 5 Oct 2009 11:45:43 +0530
EHLO mymachine.com
250-exchange_server.com Hello [111.222.3.1]
250-TURN
250-SIZE 20971520
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM
250-AUTH GSSAPI NTLM
250-X-LINK2STATE
250-XEXCH50
250 OK
MAIL FROM: <ABC\@def.com>
454 5.7.3 Client does not have permission to submit mail to this server.
RCPT TO: <mymailid\@def.com>
DATA
To: mymailid\@def.com
From: ABC\@def.com
Subject: TESTING SMTP Server
X-Mailer: Perl SendMail Module 1.09

This is a testing mail.

.
QUIT
The mail has been sent to 1 person/s successfully.
Done

I think errors are due to incorrect authentication. All the informations except the authentication type is correct. Can anybody help me in finding the correct authentication type. Any other program in shell script, or Java, C to send mail with authentication option will also do.

Thanks

Ranjith
# 2  
Old 10-05-2009
Your server expects either GSSAPI or NTLM authentication, and won't allow any simple authentication:
Code:
250-AUTH GSSAPI NTLM

If the module you're using supports those authentication schemes, use them. If not, Net::SMTP_auth supports NTLM via the Authen::NTLM module.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cron Authentication Failure error in Linux

I was bogged with an error “Authentication Failure” for all of my cron jobs in Linux Ubunutu. root@Test:~# tail -f /var/log/syslog | grep cron Dec 11 16:38:01 Test cron: Authentication failure Dec 11 16:38:01 Test cron: Authentication failure Dec 11 16:38:09 Test cron: (CRON) INFO (pidfile... (1 Reply)
Discussion started by: SULTAN01
1 Replies

2. UNIX for Dummies Questions & Answers

Sendemail Error - Authentication... failed

SCO Unix OpenServer v6. We use the script below for sending mass emails with attachments. sendemail -f $From_user -o message-file=/u/fg4/data/EmailDefaultBody.html -u $su bj -s $MAIL_SRVR -xu $MAIL_USER -xp $MAIL_PSWD -a $emlname.pdf -t $MAILTO MAIL_SVR=SMPTOUT.SECURESERVER.NET ... (0 Replies)
Discussion started by: jet47
0 Replies

3. UNIX for Dummies Questions & Answers

Kerberos Authentication error

Hi , I am trying to authenticate my id on client server with Kerberos and receiving below error kinit rpagadala@BDC.soft.net kinit: Cannot contact any KDC for realm 'BDC.soft.net' while getting initial credentials Please find krb5.conf on the client server configuration which is... (1 Reply)
Discussion started by: Tomlight
1 Replies

4. UNIX for Dummies Questions & Answers

Pearl script Net::SFTP authentication error

#!/usr/local/bin/perl -w use Net::SFTP; use File::Copy; my $user=(getpwuid($<)); my $server = "servername"; print "user - $user server - $server \n"; my %args = ( user => "$user", ssh_args => {port=> 'portnum'} ); $args{debug} = 1; $args{user} = "user"; my $sftp=Net::SFTP->new($server,... (1 Reply)
Discussion started by: Yashaswini H L
1 Replies

5. Solaris

Rpcinfo: can't contact portmapper: RPC: Authentication error; why = Failed (unspecified error)

I have two servers with a fresh install of Solaris 11, and having problems when doing rpcinfo between them. There is no firewall involved, so everything should theoretically be getting through. Does anyone have any ideas? I did a lot of Google searches, and haven't found a working solution yet. ... (2 Replies)
Discussion started by: christr
2 Replies

6. HP-UX

Error while doing key based authentication

We are trying to do a key exchange from Sun solaris server to HP UNIX server. Errro we are getting is as below:- sshd2: connection from "10.13.240.6" sshd2: auths-pam: PAM subprocess returned packet SSH_PAM_OP_ERROR. (err_num: 32, err_msg: General Commercial Security error) sshd2: User... (4 Replies)
Discussion started by: sandipmandal
4 Replies

7. Shell Programming and Scripting

KERBEROS_V4 rejected as an authentication type error

Hi am just trying to FTP am while doing so am getting the "KERBEROS_V4 rejected as an authentication type" error.Please let me know what should be done to avoid this error. The code is #!/bin/ksh -x # # Get new files only ftp # source="source.com" basedir="/home/xyz/"... (0 Replies)
Discussion started by: weknowd
0 Replies

8. UNIX for Advanced & Expert Users

ssh error: Error reading response length from authentication socket

Hi - I am getting the error `Error reading response length from authentication socket' when I ssh from my cluster to another cluster, and then back to my cluster. It doesn't seem to affect anything, but it's just annoying that it always pops up and tends to confuse new users of the cluster. I... (1 Reply)
Discussion started by: cpp6f
1 Replies

9. UNIX and Linux Applications

Custom error page when tomcat authentication fails

Hi people, i have this problem trying to get a custom error page when client authentication fails: I had configured successfully my tomcat with client authentication using certificates, and now I would like to redirect the user to a custom error page when authentication fails, but I always get a... (0 Replies)
Discussion started by: sebagra
0 Replies

10. UNIX for Advanced & Expert Users

Authentication token error?!?!

Hi all, I have upgraded my old RedHat 6.2 box to RedHat 7.3. I had couple hundreds of users on that box so i just migrated all the user account to a new box by transfering home directories, and appending to /etc/passwd /etc/shadow /etc/group. I have preserved all permittions. Everything works... (8 Replies)
Discussion started by: solvman
8 Replies
Login or Register to Ask a Question