Find the answer to your Linux question:
Results 1 to 4 of 4
Im using the mail command to send emails from my shell. Everything is working fine but i cannot seem to change the sent from name. Im using the command ... ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    4

    Mail command

    Im using the mail command to send emails from my shell. Everything is working fine but i cannot seem to change the sent from name.

    Im using the command ...

    Code:
    HDD=$(df | awk ' NR>3 (S=$5) (M=$6) { if (S>10) print "Your Systems "M" is """S" Full" } ') ; [[ $HDD ]] && echo "$HDD" | mail -s "Hard-Drives Full" email###### -- -f FROM###### >/dev/null
    But my emails are still coming from root ??

    Any Ideas ??

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    The mail command uses the send name of the user executing the command. I'm sure you are using this command in a cron job. All you need to do is change the executing user to have the mail come from another user. But I don't understand why this would be a problem.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Jul 2009
    Posts
    4
    its not a major problem but it would be nice to see my emails in my inbox coming from something other then "root".

    i just thought there was a simple switch you could use to change the sent from user,

  4. #4
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    You may try this :

    Edit your nail.rc file, perhaps /etc/nail.rc

    Add these lines :

    account test {
    set from="fancy@valid.domain"
    set smtp="your.smtp.server"
    }


    In your script, add the supplementary parameter

    -A test

    to your mail command.

    Works for me using postfix.

Posting Permissions

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