Attchment in mailx command is not happening


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Attchment in mailx command is not happening
# 1  
Old 11-08-2017
Attchment in mailx command is not happening

Attchment in mailx command is not happening with -a option .
Please find below command I tried

Code:
mailx -s "test"  -a abc.txt alokjyotibal@gmail.com


Last edited by rbatte1; 11-08-2017 at 07:18 AM.. Reason: Added CODE tags
# 2  
Old 11-08-2017
Which operating system/version is it?

The mailx '-a' switch is a relatively new option which is not supported on all implementations. Check your man page:

Code:
man mailx

# 3  
Old 11-08-2017
Code:
Linux ausulgcemeaap02.us.dell.com 2.6.32-431.el6.x86_64 #1 SMP Wed Nov 20 23:56:07 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!


---------- Post updated at 08:06 AM ---------- Previous update was at 07:58 AM ----------

Quote:
MAILX(1) User Commands MAILX(1)

NAME
mailx - send and receive Internet mail

SYNOPSIS
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . .
mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f [name]
mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]

DESCRIPTION
Mailx is an intelligent mail processing system, which has a command syntax reminiscent of ed(1) with lines replaced by messages. It is based on Berkeley Mail 8.1,
is intended to provide the functionality of the POSIX mailx command, and offers extensions for MIME, IMAP, POP3, SMTP, and S/MIME. Mailx provides enhanced fea-
tures for interactive use, such as caching and disconnected operation for IMAP, message threading, scoring, and filtering. It is also usable as a mail batch lan-
guage, both for sending and receiving mail.

The following options are accepted:

-A name
Executes an account command (see below) for name after the startup files have been read.

-a file
Attach the given file to the message.

-B Make standard input and standard output line-buffered.

-b address
Send blind carbon copies to list. List should be a comma-separated list of names.

-c address
Send carbon copies to list of users.

-D Start in disconnected mode; see the description for the disconnected variable option.

-d Enables debugging messages and disables the actual delivery of messages. Unlike -v, this option is intended for mailx development only.

-e Just check if mail is present in the system mailbox. If yes, return an exit status of zero, else, a non-zero value.

-E If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently, effectively setting the skipemp-
tybody variable at program startup. This is useful for sending messages from scripts started by cron(8).

-f [file]
Read in the contents of the user's mbox (or the specified file) for processing; when mailx is quit, it writes undeleted messages back to this file. The
string file is handled as described for the folder command below.

-F Save the message to send in a file named after the local part of the first recipient's address.

-H Print header summaries for all messages and exit.

Last edited by RudiC; 11-08-2017 at 08:01 AM.. Reason: Added CODE tags.
# 4  
Old 11-08-2017
Okay, is the attachment file in the same directory that you are in?

Does the mailx command not output an error?

For good measure, try giving the full pathname of the attachment.
# 5  
Old 11-08-2017
file is in same path . but when i ecxecute this command , it seems it is waiting for some input

Last edited by hicksd8; 11-11-2017 at 11:31 AM..
# 6  
Old 11-08-2017
file is in same path.

thanks.

Moderator's Comments:
Mod Comment How do you tell? What connection / relation do you have to the original requestor?
# 7  
Old 11-08-2017
Quote:
Originally Posted by alokjyotibal
file is in same path . but when i ecxecute this command , it seems it is waiting for some input
Yes, it's waiting for the email text to be input. If you terminate that the email should go with just a title and attachment.

For example, put your email text in a file called 'mailfile'

Then try this:

Code:
 
 echo "mailfile" | mailx -s "test"  -a "abc.txt" alokjyotibal@gmail.com


Last edited by hicksd8; 11-10-2017 at 06:44 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Help with Mailx command

I need to do below in mailx : 1. to list 2. CC list (I am using tilde command for this) 3. -r option 4. attach .csv file Below is the command i am using : ( echo '~c abc@xyz.com'; cat mailtext.txt; uuencode attach.csv attach.csv) | mailx -s "${SUBJECT}" -r "abc@xyz.com" -m ${MAIL_LIST}... (4 Replies)
Discussion started by: ManOfSteel
4 Replies

2. Shell Programming and Scripting

mailx command

( cat textfile.txt; ) | mailx -s "test mail " `cat mailids.lst` from :'server@example.com' to : for all contacts in text file mailids.lst above command is sending mails correctly for all contacts in text file mailids.lst, but 'from' address is showing as 'server@example.com' but i want... (5 Replies)
Discussion started by: only4satish
5 Replies

3. UNIX for Dummies Questions & Answers

mailx command

Hi, I am seeing that this command is sending mail even when the nawk command in untrue ( does not have any output ). I only want it to send mail, where it goes above the threshold, and has some output. nawk -F'(MOD dn="uid=)|(DEL dn="uid=)|' '/(MOD dn="uid=)|(DEL dn="uid=)/... (2 Replies)
Discussion started by: john_prince
2 Replies

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

5. Shell Programming and Scripting

Mailx command

Hi, This post is regarding sending mails from Unix. How can we include "bcc" in a "mailx" command. I searched google to find out the -b option; but my man pages doesnot show that option(it throws me an error: "-b not found"). It has a "~b" option but i am not sure how to use it. Could you people... (2 Replies)
Discussion started by: Thumban
2 Replies

6. UNIX for Dummies Questions & Answers

mailx and -s command

How does the -s command work with mailx. I know that -s is to create a symbolic link when being used with ln but i'm not sure what the command does with mailx. Anyone?:confused: (1 Reply)
Discussion started by: kjetterman
1 Replies

7. UNIX for Advanced & Expert Users

mailx command

hi, i want to pass a unix variable as the subject of the mail alongwith a string. My part of code is as below.. week_end_dt=`sqlplus -s rsamart@martdev.world/rsamart<<EOF SET FEED OFF; SET TIMING OFF; SET HEADING OFF; SET PAGESIZE 500; SET LINESIZE 1000; select... (14 Replies)
Discussion started by: Jalkukdi@10
14 Replies

8. HP-UX

Send a mail with attchment...?

Hi all, how to send an E-mail with an attchment in HP-Unix...? i am using the following command in solaris...! for HP..? uuencode $Basic_location/out.csv $Basic_location/out.csv | mailx -s "$SUBJ" $TO_LIST please let me know how we can use this in HP box...? (6 Replies)
Discussion started by: bullz26
6 Replies

9. UNIX for Advanced & Expert Users

Mailx Command

Hi, mailx -s "hi" -r "abc@yahoo.com" aaa@yahoo.com<<EOF Hi, ~<!uuencode a.txt a.txt EOF the above code is sending mails, but attachment is not going instead i just get like below ~<!uuencode a.txt a.txt Thanks. (3 Replies)
Discussion started by: shahnazurs
3 Replies

10. AIX

Ping is happening, telnet is not happening

HI all, Ping is happening to a AIX box...but telnet is not happening... AIX box doesn't have any conslole... Please help how to resolve it. Thanks in advance .. Manu (2 Replies)
Discussion started by: b_manu78
2 Replies
Login or Register to Ask a Question