Mailx error code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mailx error code
# 1  
Old 11-12-2014
Mailx error code

hi,

i am using mailx command and i need to check if the email is send or not.
Code:
mailx -s "Sub A" -a "ACB SD.txt" abc@ab
if ( $? != 0 ) then;
echo "fail"
else
echo "pass"
fi

Everytime it gives pass only. In the above example since i have not given correct email id.
# 2  
Old 11-12-2014
Hi ATWC,

you can't use mailx for that, because mailx has no information if the mail was successfully send or not because it inject the mail direct in your MTA and he accept the mail. So you will get everytime success.

You must try to send your mail like using

Code:
sendmail

directly.

Regards,
xabbu
# 3  
Old 11-12-2014
hi xabbu,

Can you please let me know the syntax for sendmail for the above mailx command.

Thanks
ATWC
# 4  
Old 11-12-2014
Hi ATWC,

I'm sorry but I've checked again without success to send mail from command line.
I got always a success.

I tried bash and python. Smilie

The User who is running the script will get an "Mail Undelivermail" in his inbox.
Maybe you can set an alias and redirect to your account so you can see it in your emails.

The only untested way: try to send the mail direct via
Code:
telnet

and
Code:
expect

.
I've no code for that sorry.

Regards,
xabbu

Last edited by xabbu; 11-12-2014 at 05:12 PM.. Reason: set code tags
# 5  
Old 11-13-2014
Do you have privileges to check the system logs? In there, you'll find lines like
Code:
Feb 15 23:02:52 hostname postfix/local[636]: 18B5E72CF: to=<abc@ab>. . .  status=sent . . .

, depending on your MTA. Or sth like status=deferred or other failure info. This does of course not include any delivery / read status.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Mailx & mail error

I have 3 Solaris Unix 5.10 machine One of them is successfully sending mails using mail commands the 2 others are not , when i try to send using mail or mailx , i get this message within few seconds drop_privileges: setuid(0) succeeded (when it should not) The working and non-working... (1 Reply)
Discussion started by: Khalidms
1 Replies

2. Shell Programming and Scripting

mailx giving error domain of sender do not exists

Hi , mailx is unable to send mail , I am getting the following error Diagnostic-Code: SMTP; 553 5.1.8 <bc00644@dev-app01-wms.domain.fds>... Domain of sender address bc00644@dev-app01-wms.domain.fds does not exist Can anyone tell me what can be the possible fix for this (2 Replies)
Discussion started by: swayam123
2 Replies

3. UNIX for Dummies Questions & Answers

Mailx command in unix shell script, its throwing below error

How to use Mailx command in unix shell script, its throwing below error #!/bin/ksh let x=3 If ; then mailx -s “ $x is greater than 2” example@gmail.com << EOF This is the message body EOF fi its throwing error as syntax error at EOF... (10 Replies)
Discussion started by: only4satish
10 Replies

4. Shell Programming and Scripting

Error related to mailx function

Hi All, I have used the following syntax for sending email. "mailx -s "process not running" userid@domain.com " I am getting below error. " mailx: not found " Can anoy one please give the reason for this error. I am using REDHAT server. (2 Replies)
Discussion started by: suresh.gunti
2 Replies

5. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

6. Solaris

mailx -s is showing an error

Error is like /users/d12381/check.sh: mail_sysadmin@mycompany: not found Plz help me to sort out this issue (6 Replies)
Discussion started by: Renjesh
6 Replies

7. Shell Programming and Scripting

getting mailx error

Hi, I was using SunOS 5.6. I have used the mailx command in below fashion mailx -s"RE: WES 'ftp' alert...no HDR record" ushman@lucent.com Last week only I upgraded the Operating System from SunOS 5.6 to SunOS5.9. But after upgrading the OS I am getting the following error. The flags you... (1 Reply)
Discussion started by: surjyap
1 Replies

8. UNIX for Dummies Questions & Answers

mailx error message : mailx: NUL changed to @

If I use the "Mail" link instead of the "mail" link to ../mailx I get this error. Mail so-n-so @whatever.com mailx: NUL changed to @ Unknown command: "postmaster" The email still goes through but i get the error. If I use "mail" it goes thru without the error. Any ideas?? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

9. UNIX for Advanced & Expert Users

mailx error

When I try to send a mail thru mailx command, my mail isnt delivered to the destination. When I type 'mail' from $HOME directory, I see the following error. Final-Recipient: RFC822; myname@company.com Action: failed Status: 5.1.2 Remote-MTA: DNS; mailhost.corp.company.com Diagnostic-Code:... (2 Replies)
Discussion started by: Deepa
2 Replies

10. UNIX for Advanced & Expert Users

mailx in kornshell script passing return code to CA-Unicenter

I have a KornShell script that has successfully been scheduled through Cron. We are in the process of changing over from Cron to using CA-Unicenter. To negative test the script I put a bad return code in. At the bottom of the script an e-mail is sent using mailx and then the return code is set... (1 Reply)
Discussion started by: Connie
1 Replies
Login or Register to Ask a Question