Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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'm sure this is an easy question: how do I change the return address to something real when I use 'mail' from the commandline?
I have an external mail server with the account jeffrey@cunningham.net. I lease this account. It is a POP and SNTP account. At home I route this using fetchmail so that I read it with kmail. In kmail I have defined the correct email return address. But if I send mail from a script or the commandline this way:
How can I change this to show the correct return address? I checked the man pages on sendmail, procmail, fetchmail, mail, aliases, and a couple others and haven't stumbled on it yet.
Thanks for the reply, Kevin. But I've searched in vain for a .mailrc setting like you suggest. For example, here is a description of the .mailrc file format, and no mention in it of a way to set the 'replyto' address:
On my system (Suse8.1) there is an /etc/mail.rc file which contains nothing useful that I can see:
set asksub append dot save crt=20
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via
I have found that in the /etc/postfix/main.cf file, if I change:
mydomain=cunningham.net
myorigin=$mydomain
I have at least corrected the domain part of both the reply to and from addresses. However, the username is that of my local account (jcunningham), not my mail account (jeffrey). How can I make it prepend my mail account name to the mail domain instead of my local account?
The reason for using mail in my current situation is not preference, its legacy: there are a large body of scripts where I work already set up to use mail to send notifications when certain stages of processing are completed. I don't own all the scripts and don't want to try changing them if I can help it. These scripts are shared and must remain so.
It took me about five minutes to configure mutt to do what I wanted. Something like this is definitely the way to go. Now I have to figure out how to get the other people involved to change the common scripts. Thanks.
I did make one, Kevin. It ignores the line. Here's my .mailrc:
set replyto="jeffrey@cunningham.net"
set fromAddress=1
alias test jeffrey@cunningham.net
I know its reading the file, because the test alias works. But both the replyto and from addresses show up as <username>.cunningham.net rather than jeffrey@cunningham.net
I'll look in that direction, Peter.
Thanks. But I succeeded in changing the domain by setting
mydomain=cunningham.net
myorigin-$mydomain
in /etc/postfix/main.cf. What I haven't figured out yet is how to set the username. It prepends the user account name to the domain for both the replyto and from lines, instead of the username at cunningham.net.
Yes, I did try "set fromline=...", but it didn't work either. Also, I could find no documentation for that set option, or anything like it in the man pages.
but for obscure reasons, this may be overridden elsewhere. I ended up abandoning the mail utility largely because everyone advised me to - its not well supported anymore apparently.
You can use mutt from scripts or the commandline like this:
You may be able to do attachments with an additional -a filename, but I haven't tried it. You set your reply to address and everything else you want to show up or happen in ~/.muttrc
I've been using metamail for scripting emails with attachments.
I had a somewhat similar problem, and consequently ended up here in search of a solution. Finding none, I "solved" it by including the following alias in my .bashrc;
alias m="mail -r 'Your Name <yourname@isp.com>'"
Note the single quotes.
This has the following effect on the recipient's 'From:' field;
From: "Your Name" <yourname@isp.com>
This obviously doesn't solve the non-functioning of "set replyto='you@whereever.com'" and no doubt there's a better solution, but this has worked fine for me and saves typing
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.