Find the answer to your Linux question:
Results 1 to 3 of 3
I have written a script which runs a simple program in the background, logs the output and emails me when the job is done. It works fine except for the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2012
    Posts
    1

    Help with a script


    I have written a script which runs a simple program in the background, logs the output and emails me when the job is done. It works fine except for the fact i am not recieving the email. I have tried a yahoo mail, a gmail but i never get the email. I have been told that:

    1) I can try the "tee" command, but i have never used this

    2) Some email services wont accept email when the sender is not specified

    This is the code i have for sending the email:

    (nice -n 10 nohup ./$user_cmd >$log_stdout 2>$log_stderr </dev/null ; echo $body `date` | mutt -s "$subj" $recipient) &

    Can someone please help me get this working properly. I am using fedora which uses the "mutt"command instead of mail.

  2. #2
    Just Joined!
    Join Date
    May 2011
    Location
    Central FL
    Posts
    91
    oddiseas:
    1) Do you have a working mail server running on this machine? (sendmail, postfix, etc)
    2) Can that mail system even deliver mail locally (from your server TO your server, not to anything remote)
    3) Have you properly configured that mail server?
    4) Do you have a correct DNS and Reverse DNS entries for this mail server?
    5) Is your firewall set correctly to allow the outgoing mail?

    Nothing with your script is going to matter at all (as far as sending mail to a remote server) until you get the above corrected.

  3. #3
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    I guess it depends on who runs the script, you can try manipulating muttrc: MuttWiki: MuttFaq/Header

    Never really used mutt, I always installed sendmail, and used something like:
    Code:
    (
    echo "To: $EMAIL"
    echo "From: $FROM"
    echo "Subject: $SUBJECT"
    echo "$BODY"
    ) | /path/to/sendmail $EMAIL
    linux user # 503963

Posting Permissions

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