Need help sending attachment via mailx

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Need help sending attachment via mailx
# 1  
Old 01-24-2016
Need help sending attachment via mailx

Hello, I am new to the Unix thing, and I am having trouble sending attachments via shell client putty through mailx.

The command I use is
Code:
$ mailx -s "Subject" user@blah.com < attachment.txt

but everytime I do that it would say Cannot open attachment.txt

I have the file save to my computer in the directory designated by putty shell client, but I can seem to get the file to open, please help.

Last edited by Don Cragun; 01-24-2016 at 09:34 PM.. Reason: Add CODE and ICODE tags.
# 2  
Old 01-24-2016
What directory is the directory designated by putty shell client?

What directory were you in when you ran the mailx command?
# 3  
Old 01-24-2016
I'm using the Putty portable client, so it's on a USB drive. The both the File and the Program is located in F:\PuTTYPortable folder which is where I would run the program.
# 4  
Old 01-25-2016
I don't think the (remote) server has access to your (local) F:\PuTTYPortable directory.
# 5  
Old 01-27-2016
You could do this with uuencode:

Code:
uuencode file.txt file.txt |mailx -s "enter subject here" emal@emal.com

# 6  
Old 01-27-2016
If you don't mind using Perl, you can download and install Perl MIME::LITE and use that.
The link includes some sample code. Last time I looked the module had not changed
in awhile. But the code works and it is easy to use.

MIME::Lite - search.cpan.org
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

mailx with attachment

Hi, When i used below command, i am able to send mail mailx -s "Testing mail working or not " babu.sudhakar@ymail.com" but if i want send attachment with mail,which syntax i need to follow to send a file as attachment. (3 Replies)
Discussion started by: sridhardwh
3 Replies

2. Shell Programming and Scripting

mailx not sending excel attachment properly

Hi, I am trying to send email with attachment using mailx command. I am using the folowing command: uuencode XX_HWSW_BUYERWISE_88963631_1.xls XX_HWSW_BUYERWISE_88963631_1.xls | mailx -s "Test Mail as Attachment" oracleams@xyz.com I get the email in the inbox. However, when I try to open the... (5 Replies)
Discussion started by: asp_julius
5 Replies

3. HP-UX

mailx with -m attachment corrupted

mailx with -m command sending emails with attachments correctly to all users except users who have email on microsoft exchange server. They are receiving attachments as garbled text in mail body (5 Replies)
Discussion started by: sankalpag
5 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

Adding an attachment as an attachment to mailx

I don't want the attachment embedded in the mail. I would like a file attached. When I do mailx -s "Report, `date +'%D %r` " -r "Notifications" bob@bob.com < /usr/local/bin/myreport.log> /dev/null It gets embedded in my email. I want a file attachment. How do I do that? (2 Replies)
Discussion started by: guessingo
2 Replies

6. Shell Programming and Scripting

mailx attachment sending large file

Hi I want to sent attachment file which is 400mb size.(single file, not tar file) is there any way that these kind of large files can be divided into small sizes and sent as attachments thanks with anticipation (3 Replies)
Discussion started by: karthikn7974
3 Replies

7. Shell Programming and Scripting

Problem while sending message and attachment with mailx

Hi All, I am trying to send a mail with an attachment and message. Following command I am using. (cat <messagefile> ; uuencode <attachmentfile> <attachmentfile>)|mailx -s"Subject" dave@email.com In the received mail, message body is appearing fine. But attachment is not coming. Rather... (2 Replies)
Discussion started by: nihar.dutta
2 Replies

8. Shell Programming and Scripting

Sending email with text & attachment using mailx

I spent some time working this out, with a little help from various forums, and thought the community would like to know : Here is how you can send an email from a single Unix command line : /usr/bin/echo "Email text\nNew line\nAnother new line" >x | uuencode sourcefile.txt sourcefile.txt |... (3 Replies)
Discussion started by: haryadoon
3 Replies

9. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

10. UNIX for Dummies Questions & Answers

mail or mailx attachment

I have used the forum to determine the format required to send attachments from hp-ux 11. the problem I have is that using mailx does not attach the file, but subsititing mailx for mail on the command line attaches the file but i'm not able to specify a subject? The attachment has been convert... (3 Replies)
Discussion started by: brettmartin99
3 Replies
Login or Register to Ask a Question