Home Questions Tags Users Unanswered. Mail command to send attachements Ask Question. Asked 6 years, 1 month ago. Active 4 years, 2 months ago. Viewed 19k times. I tried the below command uuencode data. Null Message body; hope that' ok which clearly tell that uuencode utility is not found. Ram Ram 3 3 gold badges 5 5 silver badges 11 11 bronze badges. Sometimes there is a -a option for attachments. Active Oldest Votes. Rajani Rajani 1. Sign up or log in Sign up using Google.
It only takes a minute to sign up. When you are using -a option, the mailx program will do all the necessary conversions to base64 and then to MIME format for you. No need to use uuencode. Note that using echo command makes sure that mailx will not ask you to enter subject and message body manually.
AFAIK, there is no such option in mailx program to provide different display name. In order to attach a file such that it is shown under a different name in e-mail, you can do.Linux- Send mail alert with attachment from Linux command line
Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. How to send email attachment using mailx -a with a different attachment name? Ask Question. Asked 2 years, 6 months ago. Active 11 months ago. Viewed 18k times.
The only option seems to be to copy file with a different name, and then try. Hello Jeff, Apologies. I didn't quite get your suggestion. Looks like John picked up on it in their answer. Active Oldest Votes. John Smith John Smith 1, 1 1 gold badge 8 8 silver badges 15 15 bronze badges. Hello John, Firstly, Thanks for your reply.
mailx sends text body as an attachment
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Body and subject should be kept within double quotes. To send a message to one or more people, mailx can be invoked with arguments which are the names of people to whom the mail will be sent.
In other words, mailx reads the content to send from standard input and can be redirected to like normal. Learn more. Ask Question. Asked 10 years, 1 month ago. Active 5 months ago. Viewed k times. Active Oldest Votes.
Bernardo0 3 3 3 bronze badges. I tried it but it is givinng no response. Neither it is giving some error msg nor sending the mail to myname gmail. Do there is need for any server configuration? Check your internet connection. I have a direct connection to the internet through cable, I don't use proxies or anything so it works on my side. You should also check for error messages in your inbox.
Note, however, that uuencode is a legacy technology from a bygone millennium which does not produce what we today mean by "attachments". It basically puts a machine-readable piece of jumble at the end of the message text.
In this day and age, you would be better served by a properly MIME-aware mailer. Unfortunately, there is no universally supported mailx replacement with MIME features, but if you have muttthat's probably the path of least resistance.When sending an e-mail from a command line or a script using mailxthe text intended to be a body is received as an attachment. This is often visible as a. Such e-mails might be displayed correctly by coincidence though.
This is an expected behavior. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form. Environment Red Hat Enterprise Linux RHEL 6 mailx Issue When sending an e-mail from a command line or a script using mailxthe text intended to be a body is received as an attachment.
Resolution Remove non-US-ASCII or non-printable characters from the e-mail text, or use sendmailwhich will accept and forward DOS-style formatted text, or use muttwhich provides more funcionality regarding how the e-mail should be sent.
Log in to comment. BK Newbie 5 points. Brian King. Here are the common uses of Markdown. Learn more Close. Are you sure you want to request a translation? We appreciate your interest in having Red Hat content localized to your language. Please note that excessive use of this feature could cause delays in getting specific content you are interested in translated.
We are generating a machine translation for this content. Depending on the length of the content, this process could take a while.The file is present in the "location" specified and it contains data. Please help.
Linux mail and mailx Commands Tutorial With Examples and Send Email From Command Line
Thanks, Anand. Go to Solution. Turn on suggestions. Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for. Search instead for. Did you mean:. Contact Email us Tell us what you think. Log In. New Discussion. Regular Advisor. Tags: attachments. All forum topics Previous Topic Next Topic.
Exalted Contributor. It somehow does not seem to work properly from the script. Honored Contributor. I think my script will work for you. I've never had anyone come back and say it doesn't work. Its in production on probably every continent where there are HP servers. Thanks for all the response. I have found out the issue in my perl script from which I was trying to email the output.
I did not close the filehandler before sending the mail.Once you get familiar to using the Linux terminal, you wish to do everything on your system by simply typing commands including sending emails and one of the important aspects of sending emails is attachments.
In this post, we will learn ways of sending an email with attachment from the Linux terminal. Importantly, there are several command line email clients for Linux that you can use to process emails with simple features. A MTA is an application responsible for sending and receiving emails from one host to another.
Do you have in mind any other methods of sending emails with attachment from the Linux terminal, that are not mentioned in the list above? Let us know in the comments. TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web.
Millions of people visit TecMint! If you like what you are reading, please consider buying us a coffee or 2 as a token of appreciation.
We are thankful for your never ending support. View all Posts. Aaron Kili is a Linux and F. S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge. Your name can also be listed here. Got a tip?
Submit it here to become an TecMint author. Your email address will not be published. Save my name, email, and website in this browser for the next time I comment. Notify me of followup comments via e-mail. You can also subscribe without commenting. This site uses Akismet to reduce spam. Learn how your comment data is processed. How to Install Nagios 4.
Ending In: 3 days. Ending In: 4 days. Linux Commands Below are the various, well known methods of sending email with attachment from the terminal. Using mail Command mail is part of the mailutils On Debian and mailx On RedHat package and it is used to process messages on the command line.
Using mutt Command mutt is a popular, lightweight command line email client for Linux. Using mailx Command mailx works more like the mutt command and it it also a part of mailutils On Debian package. Using mpack Command mpack encodes the named file in one or more MIME messages and sends the message to one or more recipients, or writes it to a named file or set of files, or posts it to a set of newsgroups. Sharing is Caring December 7, at pm. G says:. September 12, at am. Prathap Kumar V says:.
September 5, at pm. Got something to say?On Unix-like operating systems, the mailx command sends and receives mail. It is based on Berkeley Mail 8. It is also usable as a mail batch language, both for sending and receiving mail. To send a message to one or more people, mailx can be invoked with arguments that are the names of people to whom the mail will be sent.
The user is then expected to type in his message, followed by an ' control-D ' at the beginning of a line, which signals the end of the message, and implicit approval to send it. In normal usage mailx is given no arguments and checks the user's mail out of the mail server, then prints out a one line header of each message found.
The current message is initially the first message numbered 1 and can be printed using the print command which can be abbreviated ' p '. After examining a message the user can delete ' d ' the message, or reply ' r ' to it. Deletion causes the mailx program to forget about the message. This is not irreversible; the message can be undelete d ' u ' by giving its number, or the mailx session can be aborted by giving the exit ' x ' command. Deleted messages will, however, usually disappear never to be seen again.
Commands such as print and delete can be given a list of message numbers as arguments to apply to many messages at once. Thus ' delete 1 2 ' deletes messages 1 and 2while ' delete ' deletes messages 1 through 5. The following special message names exist:. A practical method to read a set of messages is to issue a from command with the search criteria first to check for appropriate messages, and then to read each single message by typing ' ' ' single quote repeatedly.
The reply command can be used to set up a response to a message, sending it back to the sender. Text the user types in then, up to an end-of-filedefines the contents of the message. Other escapes will set up subject fields, add and delete recipients to the message, attach files to it and allow the user to escape to an editor to revise the message or to a shell to run some commands.
The user can end a mailx session with the quit ' q ' command. Messages which have been examined go to the user's mailbox file, unless they have been deleted, in which case they are discarded.