Forward “local mails” to external SMTP server












0















I have a standalone 18.04 server just for running a simple LAMP website. Sometimes when I log in to the server I get notified that I have mail (like cron/at job outputs), and then I read them using mutt. The problem is that I get to know their existence only when I log in. Is there a configuration somewhere to automatically forward these local mails to my company email address so that I really get active notifications?



p.s. Sendmail is also installed but the only configuration I made to it is define(`SMART_HOST', `smtp.mycompany.com')dnl in /etc/mail/sendmail.mc, so that my PHP application can send emails through SMTP server with just a few lines of codes.










share|improve this question























  • What is in /etc/aliases?

    – fkraiem
    Jan 24 at 14:30
















0















I have a standalone 18.04 server just for running a simple LAMP website. Sometimes when I log in to the server I get notified that I have mail (like cron/at job outputs), and then I read them using mutt. The problem is that I get to know their existence only when I log in. Is there a configuration somewhere to automatically forward these local mails to my company email address so that I really get active notifications?



p.s. Sendmail is also installed but the only configuration I made to it is define(`SMART_HOST', `smtp.mycompany.com')dnl in /etc/mail/sendmail.mc, so that my PHP application can send emails through SMTP server with just a few lines of codes.










share|improve this question























  • What is in /etc/aliases?

    – fkraiem
    Jan 24 at 14:30














0












0








0








I have a standalone 18.04 server just for running a simple LAMP website. Sometimes when I log in to the server I get notified that I have mail (like cron/at job outputs), and then I read them using mutt. The problem is that I get to know their existence only when I log in. Is there a configuration somewhere to automatically forward these local mails to my company email address so that I really get active notifications?



p.s. Sendmail is also installed but the only configuration I made to it is define(`SMART_HOST', `smtp.mycompany.com')dnl in /etc/mail/sendmail.mc, so that my PHP application can send emails through SMTP server with just a few lines of codes.










share|improve this question














I have a standalone 18.04 server just for running a simple LAMP website. Sometimes when I log in to the server I get notified that I have mail (like cron/at job outputs), and then I read them using mutt. The problem is that I get to know their existence only when I log in. Is there a configuration somewhere to automatically forward these local mails to my company email address so that I really get active notifications?



p.s. Sendmail is also installed but the only configuration I made to it is define(`SMART_HOST', `smtp.mycompany.com')dnl in /etc/mail/sendmail.mc, so that my PHP application can send emails through SMTP server with just a few lines of codes.







mail smtp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 24 at 13:57









Jyunhao ShihJyunhao Shih

113




113













  • What is in /etc/aliases?

    – fkraiem
    Jan 24 at 14:30



















  • What is in /etc/aliases?

    – fkraiem
    Jan 24 at 14:30

















What is in /etc/aliases?

– fkraiem
Jan 24 at 14:30





What is in /etc/aliases?

– fkraiem
Jan 24 at 14:30










1 Answer
1






active

oldest

votes


















0














If you'r Sendmail/Postfix is configured and running.



Just insert/replace in /etc/aliases



root: email@yourcompany.com





share|improve this answer
























  • IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

    – AnFi
    Jan 25 at 7:24











  • My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

    – Jyunhao Shih
    Jan 28 at 0:52











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1112510%2fforward-local-mails-to-external-smtp-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If you'r Sendmail/Postfix is configured and running.



Just insert/replace in /etc/aliases



root: email@yourcompany.com





share|improve this answer
























  • IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

    – AnFi
    Jan 25 at 7:24











  • My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

    – Jyunhao Shih
    Jan 28 at 0:52
















0














If you'r Sendmail/Postfix is configured and running.



Just insert/replace in /etc/aliases



root: email@yourcompany.com





share|improve this answer
























  • IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

    – AnFi
    Jan 25 at 7:24











  • My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

    – Jyunhao Shih
    Jan 28 at 0:52














0












0








0







If you'r Sendmail/Postfix is configured and running.



Just insert/replace in /etc/aliases



root: email@yourcompany.com





share|improve this answer













If you'r Sendmail/Postfix is configured and running.



Just insert/replace in /etc/aliases



root: email@yourcompany.com






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 24 at 14:48









maxmmaxm

266




266













  • IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

    – AnFi
    Jan 25 at 7:24











  • My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

    – Jyunhao Shih
    Jan 28 at 0:52



















  • IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

    – AnFi
    Jan 25 at 7:24











  • My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

    – Jyunhao Shih
    Jan 28 at 0:52

















IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

– AnFi
Jan 25 at 7:24





IMHO it is better to keep local copy too. root: email@yourcompany.com, local_account_name

– AnFi
Jan 25 at 7:24













My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

– Jyunhao Shih
Jan 28 at 0:52





My /etc/aliases is like root: my_local_account,my_company_account@mycompany.com (new line) my_local_account: my_local_account,my_company_account@mycompany.com, and I ran sudo newaliases after editing this file. However none of the mails get sent to my company mailbox, though mails for root do get sent to my_local_account. Just now I tested my PHP application, which sends mail to users as usual, so it seems that the SMART_HOST setting in sendmail.mc as mentioned in my original post does work.

– Jyunhao Shih
Jan 28 at 0:52


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1112510%2fforward-local-mails-to-external-smtp-server%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg