Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am new to linux and i am using RHEL (Linux 2.6.18-371.el5). I have a query: How to send attachments using mailx command?
i have tried:
i. mailx -s "subject" -a "attachment" "recipient" command.
ii. echo|mailx -s ""subject" -a "attachment" "recipient"
iii. uuencode filename | mailx -s "subject" "recipient"
none of these worked for me.
I have gone through different threads in this forum but could not find anything that fits my query.
Could you guys please help me out or maybe point me towards right discussion.
Thanks!
echo|mailx -s ""subject" -a "attachment" "recipient"
with a 112 bytes binary attachment, and it worked for me. That is, I was able to send the message and found it, with attachment, in the recipient's mailbox. The mailbox contains:
Thanks berndbausch..
But it does not work.
Need other ideas.
Then you need to provide details, such as what you're trying to attach, version of RHEL, what mail system, results of the tests, etc. We need more details than "does not work".
Depending on what you're trying to send, you may have to use mime64, break it up into a multi-part message, etc., but we don't know. And have you contacted Red Hat support, since you're PAYING FOR RHEL, RIGHT??
Then you need to provide details, such as what you're trying to attach, version of RHEL, what mail system, results of the tests, etc. We need more details than "does not work".
Depending on what you're trying to send, you may have to use mime64, break it up into a multi-part message, etc., but we don't know. And have you contacted Red Hat support, since you're PAYING FOR RHEL, RIGHT??
@Tb0ne, i am trying to send a basic txt file using mailx. It uses smtp mail services
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Quote:
Originally Posted by Indranil.Nag
Hello Members,
I am new to linux and i am using RHEL (Linux 2.6.18-371.el5). I have a query: How to send attachments using mailx command?
i have tried:
i. mailx -s "subject" -a "attachment" "recipient" command.
ii. echo|mailx -s ""subject" -a "attachment" "recipient"
iii. uuencode filename | mailx -s "subject" "recipient"
none of these worked for me.
All of those commands look a little "off" to me. Are you creating a message body at all? Or did you leave that off for brevity? I'd expect to see something like:
Code:
echo "Detach this" | mailx -s subject -a attach.txt someone@remotehost
or
Code:
mailx -s subject -a attach.txt someone@remotehost < /dev/null
if you don't need/want to include a message body.
Use "tail -f" on the /var/log/mail log file -- or "journalctl -af" (or similar) -- and watch what happens when you attempt to send the email with the attachment. Is it being accepted by the remote user's mail system? Or rejected?
Is your recipient able to receive attachments at all? Or are you sending one that's very, very large?
Pure ASCII, or in any other text encoding (like ISO-8859 or utf/ucs)?
That is: is it 7-bits characters only.
Otherwise: does your version of mailx know how to encode 8-bits byte (essentially binary) files into a mail?
In essence smtp is setup to use 7-bits chars only because of possible restrictions on "systems on the way".
@Tb0ne, i am trying to send a basic txt file using mailx. It uses smtp mail services
Yes, ALL Mail systems use SMTP...that doesn't tell us anything. It's like saying "I use a computer for email"...very true, but kind of a given. To be more clear:
Are you using postfix or sendmail on the back side of things??
What version of RHEL?
What you've ACTUALLY SEEN as the results of your tests. Does anything come through? If so, what? What do you see in the mail log files???
Have you contacted RHEL support, since you're PAYING FOR RHEL????
..is all you need. AGAIN, you will need some sort of relay host set up further upstream to route the message, but you've still not said anything about your environment. With no relay host or any sort of configuration on your server to process email, it's not going anywhere, and you've not provided any information we've asked for, other than saying it's a 'text file', and 'it doesn't work'. We can't guess.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.