Sponsored Content
Top Forums Shell Programming and Scripting Error while authentication in Mailing Program Post 302358842 by ranjithpr on Monday 5th of October 2009 02:30:13 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
KBDRATE(8)						     Linux Programmer's Manual							KBDRATE(8)

NAME
kbdrate - reset the keyboard repeat rate and delay time SYNOPSIS
kbdrate [ -s ] [ -r rate ] [ -d delay ] DESCRIPTION
kbdrate is used to change the keyboard repeat rate and delay time. The delay is the amount of time that a key must be depressed before it will start to repeat. Using kbdrate without any options will reset the repeat rate to 10.9 characters per second (cps) and the delay to 250 milliseconds (ms) for Intel- and M68K-based systems. These are the IBM defaults. On SPARC-based systems it will reset the repeat rate to 5 cps and the delay to 200 ms. OPTIONS
-s Silent. No messages are printed. -r rate Change the keyboard repeat rate to rate cps. For Intel-based systems, the allowable range is from 2.0 to 30.0 cps. Only certain, specific values are possible, and the program will select the nearest possible value to the one specified. The possible values are given, in characters per second, as follows: 2.0, 2.1, 2.3, 2.5, 2.7, 3.0, 3.3, 3.7, 4.0, 4.3, 4.6, 5.0, 5.5, 6.0, 6.7, 7.5, 8.0, 8.6, 9.2, 10.0, 10.9, 12.0, 13.3, 15.0, 16.0, 17.1, 18.5, 20.0, 21.8, 24.0, 26.7, 30.0. For SPARC-based systems, the allowable range is from 0 (no repeat) to 50 cps. -d delay Change the delay to delay milliseconds. For Intel-based systems, the allowable range is from 250 to 1000 ms, in 250 ms steps. For SPARC systems, possible values are between 10 ms and 1440 ms, in 10 ms steps. -V Display a version number and exit. BUGS
Not all keyboards support all rates. Not all keyboards have the rates mapped in the same way. Setting the repeat rate on the Gateway AnyKey keyboard does not work. If someone with a Gateway figures out how to program the keyboard, please send mail to util-linux@math.uio.no. All this is very architecture dependent. Nowadays kbdrate first tries the KDKBDREP and KIOCSRATE ioctls. (The former usually works on an m68k machine, the latter for SPARC.) When these ioctls fail an ioport interface as on i386 is assumed. FILES
/etc/rc.local /dev/port Linux 1.1.19 22 June 1994 KBDRATE(8)
All times are GMT -4. The time now is 06:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy