How to make crontab email me with output?
How can I make crontab email me with the output of its jobs? I have MAILTO=redacted@yahoo.com.au above the jobs, but it doesn't work.
I know I need to use something like Postfix or Sendmail but for the life of me I cannot find out how to achieve this. I've searched and searched for a simple guide on setting up Postfix but they're all insanely complicated and expect you to be setting up a whole server to send and receive email and to know all the terms (like, what is a domain name for outgoing emails?).
All I want to do is have crontab email me. Why is this so difficult??
Additional Info:
My crontab file looks like this:
MAILTO=redacted@yahoo.com.au
1 0 * * * ~/Desktop/toskymesh.sh
59 6 * * * ~/Desktop/tooptus.sh
0 3 * * * snapraid sync
More Additional Info:
The output of ps -ef | grep '[s]endmail'
root 6840 1370 0 10:26 ? 00:00:00 sendmail: MTA: accepting connections
I know for sure cron is working, but I'm testing the mail command with echo Test | mail -s Test redacted@yahoo.com.au anyway.
email cron postfix
|
show 1 more comment
How can I make crontab email me with the output of its jobs? I have MAILTO=redacted@yahoo.com.au above the jobs, but it doesn't work.
I know I need to use something like Postfix or Sendmail but for the life of me I cannot find out how to achieve this. I've searched and searched for a simple guide on setting up Postfix but they're all insanely complicated and expect you to be setting up a whole server to send and receive email and to know all the terms (like, what is a domain name for outgoing emails?).
All I want to do is have crontab email me. Why is this so difficult??
Additional Info:
My crontab file looks like this:
MAILTO=redacted@yahoo.com.au
1 0 * * * ~/Desktop/toskymesh.sh
59 6 * * * ~/Desktop/tooptus.sh
0 3 * * * snapraid sync
More Additional Info:
The output of ps -ef | grep '[s]endmail'
root 6840 1370 0 10:26 ? 00:00:00 sendmail: MTA: accepting connections
I know for sure cron is working, but I'm testing the mail command with echo Test | mail -s Test redacted@yahoo.com.au anyway.
email cron postfix
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Got your response, but I would spend hours on this (probably). Again, search here forsendmail setup. Good luck!
– shellter
Oct 14 '14 at 0:37
@shellter I just realised there's logs formail. In one of them, it says this:Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.htmlDoes this mean the command is working but Yahoo is blocking the mail?
– Clonkex
Oct 14 '14 at 0:46
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know abouthttp://webmasters.stackexchange.com? They can probably help you better or better yetchat.stackexchange.com/rooms/524/webmasterswhere seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.
– shellter
Oct 14 '14 at 1:05
|
show 1 more comment
How can I make crontab email me with the output of its jobs? I have MAILTO=redacted@yahoo.com.au above the jobs, but it doesn't work.
I know I need to use something like Postfix or Sendmail but for the life of me I cannot find out how to achieve this. I've searched and searched for a simple guide on setting up Postfix but they're all insanely complicated and expect you to be setting up a whole server to send and receive email and to know all the terms (like, what is a domain name for outgoing emails?).
All I want to do is have crontab email me. Why is this so difficult??
Additional Info:
My crontab file looks like this:
MAILTO=redacted@yahoo.com.au
1 0 * * * ~/Desktop/toskymesh.sh
59 6 * * * ~/Desktop/tooptus.sh
0 3 * * * snapraid sync
More Additional Info:
The output of ps -ef | grep '[s]endmail'
root 6840 1370 0 10:26 ? 00:00:00 sendmail: MTA: accepting connections
I know for sure cron is working, but I'm testing the mail command with echo Test | mail -s Test redacted@yahoo.com.au anyway.
email cron postfix
How can I make crontab email me with the output of its jobs? I have MAILTO=redacted@yahoo.com.au above the jobs, but it doesn't work.
I know I need to use something like Postfix or Sendmail but for the life of me I cannot find out how to achieve this. I've searched and searched for a simple guide on setting up Postfix but they're all insanely complicated and expect you to be setting up a whole server to send and receive email and to know all the terms (like, what is a domain name for outgoing emails?).
All I want to do is have crontab email me. Why is this so difficult??
Additional Info:
My crontab file looks like this:
MAILTO=redacted@yahoo.com.au
1 0 * * * ~/Desktop/toskymesh.sh
59 6 * * * ~/Desktop/tooptus.sh
0 3 * * * snapraid sync
More Additional Info:
The output of ps -ef | grep '[s]endmail'
root 6840 1370 0 10:26 ? 00:00:00 sendmail: MTA: accepting connections
I know for sure cron is working, but I'm testing the mail command with echo Test | mail -s Test redacted@yahoo.com.au anyway.
email cron postfix
email cron postfix
edited Oct 14 '14 at 0:39
Clonkex
asked Oct 14 '14 at 0:03
ClonkexClonkex
6151714
6151714
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Got your response, but I would spend hours on this (probably). Again, search here forsendmail setup. Good luck!
– shellter
Oct 14 '14 at 0:37
@shellter I just realised there's logs formail. In one of them, it says this:Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.htmlDoes this mean the command is working but Yahoo is blocking the mail?
– Clonkex
Oct 14 '14 at 0:46
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know abouthttp://webmasters.stackexchange.com? They can probably help you better or better yetchat.stackexchange.com/rooms/524/webmasterswhere seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.
– shellter
Oct 14 '14 at 1:05
|
show 1 more comment
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Got your response, but I would spend hours on this (probably). Again, search here forsendmail setup. Good luck!
– shellter
Oct 14 '14 at 0:37
@shellter I just realised there's logs formail. In one of them, it says this:Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.htmlDoes this mean the command is working but Yahoo is blocking the mail?
– Clonkex
Oct 14 '14 at 0:46
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know abouthttp://webmasters.stackexchange.com? They can probably help you better or better yetchat.stackexchange.com/rooms/524/webmasterswhere seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.
– shellter
Oct 14 '14 at 1:05
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Got your response, but I would spend hours on this (probably). Again, search here for
sendmail setup. Good luck!– shellter
Oct 14 '14 at 0:37
Got your response, but I would spend hours on this (probably). Again, search here for
sendmail setup. Good luck!– shellter
Oct 14 '14 at 0:37
@shellter I just realised there's logs for
mail. In one of them, it says this: Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html Does this mean the command is working but Yahoo is blocking the mail?– Clonkex
Oct 14 '14 at 0:46
@shellter I just realised there's logs for
mail. In one of them, it says this: Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html Does this mean the command is working but Yahoo is blocking the mail?– Clonkex
Oct 14 '14 at 0:46
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know about
http://webmasters.stackexchange.com ? They can probably help you better or better yet chat.stackexchange.com/rooms/524/webmasters where seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.– shellter
Oct 14 '14 at 1:05
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know about
http://webmasters.stackexchange.com ? They can probably help you better or better yet chat.stackexchange.com/rooms/524/webmasters where seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.– shellter
Oct 14 '14 at 1:05
|
show 1 more comment
4 Answers
4
active
oldest
votes
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run
sudo apt-get install ssmtp.Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes(more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point theTLS_CA_File=line in ssmtp.conf to the correct location.Open the file
/etc/ssmtp/revaliasesand add the line[yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing your name with 'root'.That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
- Save and close the file, then to check you don't have the real sendmail installed, run
sendmail -V- it should say 'sSMTP'. - Finally, run
cat fileWithEmailInIt.txt | sendmail -i -t, then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).
Additional note: If you have trouble with Gmail, try option 1 of this answer (thanks to Ben Creasy for that info).
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address forhostnameas currently shown). This answer suggests that you can use default server certificates, but I found I did not need aTLS_CA_File=line for sending via GMail.
– Mark Berry
May 11 '17 at 19:25
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
|
show 12 more comments
Install Postfix. It is more complicated than most other packages but it's still not complicated.
sudo apt-get install postfix
Select "Internet Site" and then accept all the defaults. Then we just need to stop outside connections, turning this into a "null client". Run: sudoedit /etc/postfix/main.cf and find the inet_interfaces setting (near the end) and change it to loopback-only, like so:
inet_interfaces = loopback-only
And finally restart Postfix with sudo /etc/init.d/postfix restart (reloading won't do).
You now have a Postfix install that won't relay email for outside machines, it'll just accept connections on 127.0.0.1 (and ::1 for IPv6).
On a separate note, your cron lines are probably not working because you're using non-relative paths and paths with Bash substitutions in. sh doesn't understand ~ and it might not have a proper PATH set. So replace them with (I'm just guessing at the actual paths):
1 0 * * * /home/clonkex/Desktop/toskymesh.sh
59 6 * * * /home/clonkex/Desktop/tooptus.sh
0 3 * * * /usr/bin/snapraid sync
And if your scripts require to be run from a specific directory, make sure they cd into the right directory. Don't assume that cron will be in the right place as it likely won't.
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with~/Desktop/.
– Clonkex
Oct 14 '14 at 8:31
2
I neededinet_interfaces = localhost. loopback-only gave mepostfix: fatal: config variable inet_interfaces: host not found: loopback-only
– craq
Jun 28 '17 at 8:50
add a comment |
I had very good luck with exim4.
sudo apt-get install alpine exim4 mailutils eximon4 spf-tools-perl swaks
(alpine is just the mail client I like using)
After that, I ran
sudo dpkg-reconfigure exim4-config
and followed through the prompts. This page: https://help.ubuntu.com/community/Exim4 was very helpful as well. It took me about 10 minutes to get it running.
add a comment |
From sSMTP manpage: "It does not do aliasing, which must be done either in the user agent or on the mailhub. Nor does it honor .forwards, which have to be done on the recieving host. It especially does not deliver to pipelines."
So, if you want to receive all msgs sent to root on your extenal email, it's a bad idea to use sSMTP, because it does not support aliases.
Instead, you could user postfix. It's still very simple. Here's how to use it with gmail as your smtp for sending messages:
sudo apt-get install postfix mailutils
General type of mail configuration: Satellite system
System mail name: The preferred fully-qualified name of the mail server, e.g., mail.example.com
SMTP relay host (blank for none): [smtp.gmail.com]:587
Add to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
Create /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 emailtouseforsending@gmail.com:password
Then:
sudo postmap /etc/postfix/sasl/sasl_passwd
sudo chown -R root:postfix /etc/postfix/sasl
sudo chmod 750 /etc/postfix/sasl
sudo chmod 640 /etc/postfix/sasl/sasl_passwd*
Edit /etc/aliases and add:
root: email@example.com
Lastly, run:
sudo newaliases
sudo systemctl stop postfix.service
sudo systemctl start postfix.service
Now, you can test if redirecting is working:
echo "Test to root." | mail -s "Test message to root" root
Hope it helps.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f536766%2fhow-to-make-crontab-email-me-with-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run
sudo apt-get install ssmtp.Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes(more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point theTLS_CA_File=line in ssmtp.conf to the correct location.Open the file
/etc/ssmtp/revaliasesand add the line[yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing your name with 'root'.That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
- Save and close the file, then to check you don't have the real sendmail installed, run
sendmail -V- it should say 'sSMTP'. - Finally, run
cat fileWithEmailInIt.txt | sendmail -i -t, then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).
Additional note: If you have trouble with Gmail, try option 1 of this answer (thanks to Ben Creasy for that info).
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address forhostnameas currently shown). This answer suggests that you can use default server certificates, but I found I did not need aTLS_CA_File=line for sending via GMail.
– Mark Berry
May 11 '17 at 19:25
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
|
show 12 more comments
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run
sudo apt-get install ssmtp.Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes(more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point theTLS_CA_File=line in ssmtp.conf to the correct location.Open the file
/etc/ssmtp/revaliasesand add the line[yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing your name with 'root'.That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
- Save and close the file, then to check you don't have the real sendmail installed, run
sendmail -V- it should say 'sSMTP'. - Finally, run
cat fileWithEmailInIt.txt | sendmail -i -t, then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).
Additional note: If you have trouble with Gmail, try option 1 of this answer (thanks to Ben Creasy for that info).
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address forhostnameas currently shown). This answer suggests that you can use default server certificates, but I found I did not need aTLS_CA_File=line for sending via GMail.
– Mark Berry
May 11 '17 at 19:25
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
|
show 12 more comments
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run
sudo apt-get install ssmtp.Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes(more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point theTLS_CA_File=line in ssmtp.conf to the correct location.Open the file
/etc/ssmtp/revaliasesand add the line[yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing your name with 'root'.That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
- Save and close the file, then to check you don't have the real sendmail installed, run
sendmail -V- it should say 'sSMTP'. - Finally, run
cat fileWithEmailInIt.txt | sendmail -i -t, then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).
Additional note: If you have trouble with Gmail, try option 1 of this answer (thanks to Ben Creasy for that info).
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run
sudo apt-get install ssmtp.Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes(more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point theTLS_CA_File=line in ssmtp.conf to the correct location.Open the file
/etc/ssmtp/revaliasesand add the line[yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing your name with 'root'.That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
- Save and close the file, then to check you don't have the real sendmail installed, run
sendmail -V- it should say 'sSMTP'. - Finally, run
cat fileWithEmailInIt.txt | sendmail -i -t, then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).
Additional note: If you have trouble with Gmail, try option 1 of this answer (thanks to Ben Creasy for that info).
edited May 23 '17 at 12:39
Community♦
1
1
answered Oct 14 '14 at 12:23
ClonkexClonkex
6151714
6151714
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address forhostnameas currently shown). This answer suggests that you can use default server certificates, but I found I did not need aTLS_CA_File=line for sending via GMail.
– Mark Berry
May 11 '17 at 19:25
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
|
show 12 more comments
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address forhostnameas currently shown). This answer suggests that you can use default server certificates, but I found I did not need aTLS_CA_File=line for sending via GMail.
– Mark Berry
May 11 '17 at 19:25
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Whoa, the formatting is totally stuffed there. Gimme a sec to fix it...
– Clonkex
Oct 14 '14 at 12:23
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
Hmm... formatting is at least readable now. I just cannot get it to look neat...
– Clonkex
Oct 14 '14 at 12:38
1
1
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
For Gmail, I ran into serverfault.com/questions/635139/… and had to enable access for less secure apps
– Ben Creasy
Dec 12 '16 at 6:55
2
2
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address for
hostname as currently shown). This answer suggests that you can use default server certificates, but I found I did not need a TLS_CA_File= line for sending via GMail.– Mark Berry
May 11 '17 at 19:25
Thanks for the sSMTP suggestion.The Ubuntu Wiki has a helpful guide (but don't use an email address for
hostname as currently shown). This answer suggests that you can use default server certificates, but I found I did not need a TLS_CA_File= line for sending via GMail.– Mark Berry
May 11 '17 at 19:25
1
1
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
@MattM. Not deprecated, just not maintained. It should be totally fine to use sSMTP in a non-production environment :)
– Clonkex
May 21 '18 at 5:39
|
show 12 more comments
Install Postfix. It is more complicated than most other packages but it's still not complicated.
sudo apt-get install postfix
Select "Internet Site" and then accept all the defaults. Then we just need to stop outside connections, turning this into a "null client". Run: sudoedit /etc/postfix/main.cf and find the inet_interfaces setting (near the end) and change it to loopback-only, like so:
inet_interfaces = loopback-only
And finally restart Postfix with sudo /etc/init.d/postfix restart (reloading won't do).
You now have a Postfix install that won't relay email for outside machines, it'll just accept connections on 127.0.0.1 (and ::1 for IPv6).
On a separate note, your cron lines are probably not working because you're using non-relative paths and paths with Bash substitutions in. sh doesn't understand ~ and it might not have a proper PATH set. So replace them with (I'm just guessing at the actual paths):
1 0 * * * /home/clonkex/Desktop/toskymesh.sh
59 6 * * * /home/clonkex/Desktop/tooptus.sh
0 3 * * * /usr/bin/snapraid sync
And if your scripts require to be run from a specific directory, make sure they cd into the right directory. Don't assume that cron will be in the right place as it likely won't.
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with~/Desktop/.
– Clonkex
Oct 14 '14 at 8:31
2
I neededinet_interfaces = localhost. loopback-only gave mepostfix: fatal: config variable inet_interfaces: host not found: loopback-only
– craq
Jun 28 '17 at 8:50
add a comment |
Install Postfix. It is more complicated than most other packages but it's still not complicated.
sudo apt-get install postfix
Select "Internet Site" and then accept all the defaults. Then we just need to stop outside connections, turning this into a "null client". Run: sudoedit /etc/postfix/main.cf and find the inet_interfaces setting (near the end) and change it to loopback-only, like so:
inet_interfaces = loopback-only
And finally restart Postfix with sudo /etc/init.d/postfix restart (reloading won't do).
You now have a Postfix install that won't relay email for outside machines, it'll just accept connections on 127.0.0.1 (and ::1 for IPv6).
On a separate note, your cron lines are probably not working because you're using non-relative paths and paths with Bash substitutions in. sh doesn't understand ~ and it might not have a proper PATH set. So replace them with (I'm just guessing at the actual paths):
1 0 * * * /home/clonkex/Desktop/toskymesh.sh
59 6 * * * /home/clonkex/Desktop/tooptus.sh
0 3 * * * /usr/bin/snapraid sync
And if your scripts require to be run from a specific directory, make sure they cd into the right directory. Don't assume that cron will be in the right place as it likely won't.
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with~/Desktop/.
– Clonkex
Oct 14 '14 at 8:31
2
I neededinet_interfaces = localhost. loopback-only gave mepostfix: fatal: config variable inet_interfaces: host not found: loopback-only
– craq
Jun 28 '17 at 8:50
add a comment |
Install Postfix. It is more complicated than most other packages but it's still not complicated.
sudo apt-get install postfix
Select "Internet Site" and then accept all the defaults. Then we just need to stop outside connections, turning this into a "null client". Run: sudoedit /etc/postfix/main.cf and find the inet_interfaces setting (near the end) and change it to loopback-only, like so:
inet_interfaces = loopback-only
And finally restart Postfix with sudo /etc/init.d/postfix restart (reloading won't do).
You now have a Postfix install that won't relay email for outside machines, it'll just accept connections on 127.0.0.1 (and ::1 for IPv6).
On a separate note, your cron lines are probably not working because you're using non-relative paths and paths with Bash substitutions in. sh doesn't understand ~ and it might not have a proper PATH set. So replace them with (I'm just guessing at the actual paths):
1 0 * * * /home/clonkex/Desktop/toskymesh.sh
59 6 * * * /home/clonkex/Desktop/tooptus.sh
0 3 * * * /usr/bin/snapraid sync
And if your scripts require to be run from a specific directory, make sure they cd into the right directory. Don't assume that cron will be in the right place as it likely won't.
Install Postfix. It is more complicated than most other packages but it's still not complicated.
sudo apt-get install postfix
Select "Internet Site" and then accept all the defaults. Then we just need to stop outside connections, turning this into a "null client". Run: sudoedit /etc/postfix/main.cf and find the inet_interfaces setting (near the end) and change it to loopback-only, like so:
inet_interfaces = loopback-only
And finally restart Postfix with sudo /etc/init.d/postfix restart (reloading won't do).
You now have a Postfix install that won't relay email for outside machines, it'll just accept connections on 127.0.0.1 (and ::1 for IPv6).
On a separate note, your cron lines are probably not working because you're using non-relative paths and paths with Bash substitutions in. sh doesn't understand ~ and it might not have a proper PATH set. So replace them with (I'm just guessing at the actual paths):
1 0 * * * /home/clonkex/Desktop/toskymesh.sh
59 6 * * * /home/clonkex/Desktop/tooptus.sh
0 3 * * * /usr/bin/snapraid sync
And if your scripts require to be run from a specific directory, make sure they cd into the right directory. Don't assume that cron will be in the right place as it likely won't.
edited Oct 14 '14 at 8:28
answered Oct 14 '14 at 8:16
Oli♦Oli
220k86558762
220k86558762
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with~/Desktop/.
– Clonkex
Oct 14 '14 at 8:31
2
I neededinet_interfaces = localhost. loopback-only gave mepostfix: fatal: config variable inet_interfaces: host not found: loopback-only
– craq
Jun 28 '17 at 8:50
add a comment |
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with~/Desktop/.
– Clonkex
Oct 14 '14 at 8:31
2
I neededinet_interfaces = localhost. loopback-only gave mepostfix: fatal: config variable inet_interfaces: host not found: loopback-only
– craq
Jun 28 '17 at 8:50
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
Thanks, but Postfix is complicated, if only because there seem to be no simple guides whatsoever. Anyway, I got it working just fine with sSMTP which does exactly what I need and is genuinely simple (although it still took a lot of fiddling and random guessing to get it to actually work). I meant to post an answer but forgot - I actually managed to destroy my OS installation so as soon as I've got it going again fully I'll post my own answer :)
– Clonkex
Oct 14 '14 at 8:25
And actually my cron jobs worked just fine with
~/Desktop/.– Clonkex
Oct 14 '14 at 8:31
And actually my cron jobs worked just fine with
~/Desktop/.– Clonkex
Oct 14 '14 at 8:31
2
2
I needed
inet_interfaces = localhost. loopback-only gave me postfix: fatal: config variable inet_interfaces: host not found: loopback-only– craq
Jun 28 '17 at 8:50
I needed
inet_interfaces = localhost. loopback-only gave me postfix: fatal: config variable inet_interfaces: host not found: loopback-only– craq
Jun 28 '17 at 8:50
add a comment |
I had very good luck with exim4.
sudo apt-get install alpine exim4 mailutils eximon4 spf-tools-perl swaks
(alpine is just the mail client I like using)
After that, I ran
sudo dpkg-reconfigure exim4-config
and followed through the prompts. This page: https://help.ubuntu.com/community/Exim4 was very helpful as well. It took me about 10 minutes to get it running.
add a comment |
I had very good luck with exim4.
sudo apt-get install alpine exim4 mailutils eximon4 spf-tools-perl swaks
(alpine is just the mail client I like using)
After that, I ran
sudo dpkg-reconfigure exim4-config
and followed through the prompts. This page: https://help.ubuntu.com/community/Exim4 was very helpful as well. It took me about 10 minutes to get it running.
add a comment |
I had very good luck with exim4.
sudo apt-get install alpine exim4 mailutils eximon4 spf-tools-perl swaks
(alpine is just the mail client I like using)
After that, I ran
sudo dpkg-reconfigure exim4-config
and followed through the prompts. This page: https://help.ubuntu.com/community/Exim4 was very helpful as well. It took me about 10 minutes to get it running.
I had very good luck with exim4.
sudo apt-get install alpine exim4 mailutils eximon4 spf-tools-perl swaks
(alpine is just the mail client I like using)
After that, I ran
sudo dpkg-reconfigure exim4-config
and followed through the prompts. This page: https://help.ubuntu.com/community/Exim4 was very helpful as well. It took me about 10 minutes to get it running.
answered Sep 11 '15 at 17:06
Oh ArOh Ar
311
311
add a comment |
add a comment |
From sSMTP manpage: "It does not do aliasing, which must be done either in the user agent or on the mailhub. Nor does it honor .forwards, which have to be done on the recieving host. It especially does not deliver to pipelines."
So, if you want to receive all msgs sent to root on your extenal email, it's a bad idea to use sSMTP, because it does not support aliases.
Instead, you could user postfix. It's still very simple. Here's how to use it with gmail as your smtp for sending messages:
sudo apt-get install postfix mailutils
General type of mail configuration: Satellite system
System mail name: The preferred fully-qualified name of the mail server, e.g., mail.example.com
SMTP relay host (blank for none): [smtp.gmail.com]:587
Add to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
Create /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 emailtouseforsending@gmail.com:password
Then:
sudo postmap /etc/postfix/sasl/sasl_passwd
sudo chown -R root:postfix /etc/postfix/sasl
sudo chmod 750 /etc/postfix/sasl
sudo chmod 640 /etc/postfix/sasl/sasl_passwd*
Edit /etc/aliases and add:
root: email@example.com
Lastly, run:
sudo newaliases
sudo systemctl stop postfix.service
sudo systemctl start postfix.service
Now, you can test if redirecting is working:
echo "Test to root." | mail -s "Test message to root" root
Hope it helps.
add a comment |
From sSMTP manpage: "It does not do aliasing, which must be done either in the user agent or on the mailhub. Nor does it honor .forwards, which have to be done on the recieving host. It especially does not deliver to pipelines."
So, if you want to receive all msgs sent to root on your extenal email, it's a bad idea to use sSMTP, because it does not support aliases.
Instead, you could user postfix. It's still very simple. Here's how to use it with gmail as your smtp for sending messages:
sudo apt-get install postfix mailutils
General type of mail configuration: Satellite system
System mail name: The preferred fully-qualified name of the mail server, e.g., mail.example.com
SMTP relay host (blank for none): [smtp.gmail.com]:587
Add to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
Create /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 emailtouseforsending@gmail.com:password
Then:
sudo postmap /etc/postfix/sasl/sasl_passwd
sudo chown -R root:postfix /etc/postfix/sasl
sudo chmod 750 /etc/postfix/sasl
sudo chmod 640 /etc/postfix/sasl/sasl_passwd*
Edit /etc/aliases and add:
root: email@example.com
Lastly, run:
sudo newaliases
sudo systemctl stop postfix.service
sudo systemctl start postfix.service
Now, you can test if redirecting is working:
echo "Test to root." | mail -s "Test message to root" root
Hope it helps.
add a comment |
From sSMTP manpage: "It does not do aliasing, which must be done either in the user agent or on the mailhub. Nor does it honor .forwards, which have to be done on the recieving host. It especially does not deliver to pipelines."
So, if you want to receive all msgs sent to root on your extenal email, it's a bad idea to use sSMTP, because it does not support aliases.
Instead, you could user postfix. It's still very simple. Here's how to use it with gmail as your smtp for sending messages:
sudo apt-get install postfix mailutils
General type of mail configuration: Satellite system
System mail name: The preferred fully-qualified name of the mail server, e.g., mail.example.com
SMTP relay host (blank for none): [smtp.gmail.com]:587
Add to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
Create /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 emailtouseforsending@gmail.com:password
Then:
sudo postmap /etc/postfix/sasl/sasl_passwd
sudo chown -R root:postfix /etc/postfix/sasl
sudo chmod 750 /etc/postfix/sasl
sudo chmod 640 /etc/postfix/sasl/sasl_passwd*
Edit /etc/aliases and add:
root: email@example.com
Lastly, run:
sudo newaliases
sudo systemctl stop postfix.service
sudo systemctl start postfix.service
Now, you can test if redirecting is working:
echo "Test to root." | mail -s "Test message to root" root
Hope it helps.
From sSMTP manpage: "It does not do aliasing, which must be done either in the user agent or on the mailhub. Nor does it honor .forwards, which have to be done on the recieving host. It especially does not deliver to pipelines."
So, if you want to receive all msgs sent to root on your extenal email, it's a bad idea to use sSMTP, because it does not support aliases.
Instead, you could user postfix. It's still very simple. Here's how to use it with gmail as your smtp for sending messages:
sudo apt-get install postfix mailutils
General type of mail configuration: Satellite system
System mail name: The preferred fully-qualified name of the mail server, e.g., mail.example.com
SMTP relay host (blank for none): [smtp.gmail.com]:587
Add to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
Create /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 emailtouseforsending@gmail.com:password
Then:
sudo postmap /etc/postfix/sasl/sasl_passwd
sudo chown -R root:postfix /etc/postfix/sasl
sudo chmod 750 /etc/postfix/sasl
sudo chmod 640 /etc/postfix/sasl/sasl_passwd*
Edit /etc/aliases and add:
root: email@example.com
Lastly, run:
sudo newaliases
sudo systemctl stop postfix.service
sudo systemctl start postfix.service
Now, you can test if redirecting is working:
echo "Test to root." | mail -s "Test message to root" root
Hope it helps.
answered Jun 2 '18 at 4:27
duliduli
1194
1194
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f536766%2fhow-to-make-crontab-email-me-with-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@shellter forgot to tag you.
– Clonkex
Oct 14 '14 at 0:34
Very good testing! You should include this info in your original question. At this point, I'm past being able to help. Your'e on the right track, but, "Why is it so difficult" .... Sorry ... that would be that Linux/Unix is a highly configurable system. Everyone has their own special case, for which the configuration must be changed.
– shellter
Oct 14 '14 at 0:36
Got your response, but I would spend hours on this (probably). Again, search here for
sendmail setup. Good luck!– shellter
Oct 14 '14 at 0:37
@shellter I just realised there's logs for
mail. In one of them, it says this:Diagnostic-Code: SMTP; 553 5.7.1 [BL21] Connections will not be accepted from [MyIPRedacted], because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.htmlDoes this mean the command is working but Yahoo is blocking the mail?– Clonkex
Oct 14 '14 at 0:46
beyond my pay-grade, but that's a pretty explicit message, so it would seem so. As you probably know, try sending from a different IP and see if it goes thru OR if the error message changes. Do you know about
http://webmasters.stackexchange.com? They can probably help you better or better yetchat.stackexchange.com/rooms/524/webmasterswhere seemingly all questions are welcome (hm.. you may need more rep to get in, are you on any other stackexchange sites?) Good luck.– shellter
Oct 14 '14 at 1:05