Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

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) &

Can someone please help me get this working properly? Why am I not recieving the email?

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.

share|improve this question
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

1 Answer 1

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
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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