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 fact I am not receiving 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 won't accept email when the sender is not specified

I am using Fedora. This is the code I have for logging the results of the background program and then sending the email:

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

If this is not clear let me know and I will post the entire script. Basically the objective is to get the email sent using the nice and nohup commands.

2
  • 2
    You have to configure either mutt or your mail delivery agent. Most mail servers won't accept mail from an dynamic ip address so you should probably use the mail server from your providerCommentedJun 20, 2012 at 9:24
  • So what changes do i need to make to my code to do this, i have installed mutt what do you mean when you say configure?CommentedJun 20, 2012 at 9:28

1 Answer 1

4

There are many reasons, why you can't receive your mail(spam, MTA not conifgured). The easiest way to achieve this - configure your MTA to work through gmail SMTP servers.

But first make sure that you have MTA installed!

Here some configuration examples for different MTAs:

Postfix http://ubuntulinux.co.in/blog/ubuntu/set-up-postfix-for-relaying-emails-via-gmail-smtp-server/

Exim http://wiki.debian.org/GmailAndExim4

Sendmail http://appgirl.net/blog/configuring-sendmail-to-relay-through-gmail-smtp/

Otherwise, if you don't want to use google, make sure:

  1. MTA is installed & properly configured, so you could see you mail in mail queue ( check it with mailq command )
  2. If MTA can send mail, check "returned mail" in your queue, it can be possibly be marked as spam
1
  • also look at nullmailer, for hosts that only send, but never receive mail. very little configuration needed.
    – hildred
    CommentedNov 24, 2013 at 20:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.