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
    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 provider – Ulrich Dangel Jun 20 '12 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? – Johnny Williem Jun 20 '12 at 9:28

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
  • also look at nullmailer, for hosts that only send, but never receive mail. very little configuration needed. – hildred Nov 24 '13 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.