Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Change "From address" with the mail command

  1. #1

    Default Change "From address" with the mail command

    Despite what the man page says, and what I have read out on the web, I cannot get the mail command to let me change the "from address"

    I have tried to change the reply address (-R my@address.com)
    I have tried to change the from address (-f my@address.com)
    ..... and so on

    Anyone have any luck, from the command line (as I am setting up cron jobs) in changing the "from" address?

    echo test | mail -s "This is a test" user@domain.com (this is the basic command I wish to use, but change the "from address")

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,655
    Blog Entries
    15

    Default Re: Change "From address" with the mail command

    Quote Originally Posted by joharmon
    Despite what the man page says, and what I have read out on the web, I
    cannot get the mail command to let me change the "from address"

    I have tried to change the reply address (-R my@address.com)
    I have tried to change the from address (-f my@address.com)
    ..... and so on

    Anyone have any luck, from the command line (as I am setting up cron
    jobs) in changing the "from" address?

    echo test | mail -s "This is a test" user@domain.com (this is the basic
    command I wish to use, but change the "from address")

    Hi
    It's -r not -R to set the 'From' address.

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.24-0.2-default
    up 1:37, 2 users, load average: 0.14, 0.10, 0.08
    GPU GeForce 8600 GTS Silent - Driver Version: 260.19.21


  3. #3
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: Change "From address" with the mail command

    As far as I remember only a "trusted" user can do this. For sendmail they are listed in /etc/mail/trusted-users; for postfix: I don't know.
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,486
    Blog Entries
    3

    Default Re: Change "From address" with the mail command

    Anybody can do this with sendmail. But for an untrusted user, an "X-Authentication-Warning:" header is added.

    Note that I just tested, and it is fine.

    I don't know what happens with postfix, though I might experiment later today.

    I used: mailx -rsender@hostname recipient

  5. #5
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: Change "From address" with the mail command

    Anybody can do this with sendmail. But for an untrusted user, an "X-Authentication-Warning:" header is added.
    Correct. Thanks for refreshing my memory.
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Change "From address" with the mail command

    On 2010-12-06 13:36, nrickert wrote:

    > I don't know what happens with postfix, though I might experiment later
    > today.


    It doesn't matter if you are using mailx. It would, perhaps, if you used
    sendmail (postfix has a small sendmail binary for compatibility).

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  7. #7

    Default Re: Change "From address" with the mail command

    Quote Originally Posted by malcolmlewis View Post
    Hi
    It's -r not -R to set the 'From' address.

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.24-0.2-default
    up 1:37, 2 users, load average: 0.14, 0.10, 0.08
    GPU GeForce 8600 GTS Silent - Driver Version: 260.19.21
    echo test | mail -s test -r me@mydomain.com me@mydomain.com
    send-mail: illegal option -- r
    sendmail: usage: sendmail [ -t ] [ -fsender ] [ -Fname ] [ -bp ] [ -bs ] [ arg ... ]

  8. #8

    Default Re: Change "From address" with the mail command

    Quote Originally Posted by nrickert View Post
    Anybody can do this with sendmail. But for an untrusted user, an "X-Authentication-Warning:" header is added.

    Note that I just tested, and it is fine.

    I don't know what happens with postfix, though I might experiment later today.

    I used: mailx -rsender@hostname recipient
    Can you do it with just mail, and not mailx?

  9. #9

    Default Re: Change "From address" with the mail command

    Quote Originally Posted by vodoo View Post
    As far as I remember only a "trusted" user can do this. For sendmail they are listed in /etc/mail/trusted-users; for postfix: I don't know.
    I am not using postfix or sendmail. I am using qmail. Anything I need to tweak for that?

  10. #10
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: Change "From address" with the mail command

    Can you do it with just mail, and not mailx?
    Code:
    > ls -l /usr/bin/mail
    lrwxrwxrwx 1 root root 5 Sep 24 10:18 /usr/bin/mail -> mailx
    Yes, you can. The 'mail' command is a symbolic link to 'mailx'. A command may behave different according to the name under which it is called, but with mailx it should make no difference.

    You can also set the 'from' variable instead of using the -r option. (man mailx).
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •