How to configure sendmail to only send to specified domains?How do I allow sendmail to send TO any...
What will happen if my luggage gets delayed?
How can I portion out frozen cookie dough?
School performs periodic password audits. Is my password compromised?
Create chunks from an array
Idiom for feeling after taking risk and someone else being rewarded
What would be the most expensive material to an intergalactic society?
Smooth vector fields on a surface modulo diffeomorphisms
How should I solve this integral with changing parameters?
What is Tony Stark injecting into himself in Iron Man 3?
Giving a career talk in my old university, how prominently should I tell students my salary?
Is there stress on two letters on the word стоят
Rationale to prefer local variables over instance variables?
Locked Away- What am I?
How do I increase the number of TTY consoles?
How can a demon take control of a human body during REM sleep?
What is better: yes / no radio, or simple checkbox?
Can I negotiate a patent idea for a raise, under French law?
Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?
Computation logic of Partway in TikZ
Too soon for a plot twist?
Graphic representation of a triangle using ArrayPlot
Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?
Sampling from Gaussian mixture models, when are the sampled data independent?
How do we create new idioms and use them in a novel?
How to configure sendmail to only send to specified domains?
How do I allow sendmail to send TO any address?Sending mail from PHP with exim4Setting up Mail (Ubuntu Server 10.04)Redirect all email sent via PHP's mail() function to single external addressMail sent by PHP not being recieved by accounts on Google AppsHow can I configure sendmail (or another mail server) to accept outbound mail, but to not send it out?Send email from server to Google Apps email address (same domains)Sendmail wont send to same domainWhy does sendmail changes the FROM domain and how to configure the proper one?Linux Centos Sendmail only sending to 20 recipients
I have a local development server (centos) which I develop a number of websites on. Occasionally I need to test email sending scripts.
I want to avoid the development server from sending emails to anyone who doesn't have an email address with a particular domain (ie: jon@mydomain.com, mary@mydomain.com, etc). So, I would like to create a white list or rule on the server which prevents emails being sent to any email address that doesn't match mydomain.com.
I'm currently using PHP's built-in mail() function. But I imagine this is something more on the server level and I would like something that will manage ANY emails sent out from the server from any program/app/script/etc.
I can confirm that PHP is using /usr/sbin/sendmail.sendmail
linux centos php email sendmail
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a local development server (centos) which I develop a number of websites on. Occasionally I need to test email sending scripts.
I want to avoid the development server from sending emails to anyone who doesn't have an email address with a particular domain (ie: jon@mydomain.com, mary@mydomain.com, etc). So, I would like to create a white list or rule on the server which prevents emails being sent to any email address that doesn't match mydomain.com.
I'm currently using PHP's built-in mail() function. But I imagine this is something more on the server level and I would like something that will manage ANY emails sent out from the server from any program/app/script/etc.
I can confirm that PHP is using /usr/sbin/sendmail.sendmail
linux centos php email sendmail
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a local development server (centos) which I develop a number of websites on. Occasionally I need to test email sending scripts.
I want to avoid the development server from sending emails to anyone who doesn't have an email address with a particular domain (ie: jon@mydomain.com, mary@mydomain.com, etc). So, I would like to create a white list or rule on the server which prevents emails being sent to any email address that doesn't match mydomain.com.
I'm currently using PHP's built-in mail() function. But I imagine this is something more on the server level and I would like something that will manage ANY emails sent out from the server from any program/app/script/etc.
I can confirm that PHP is using /usr/sbin/sendmail.sendmail
linux centos php email sendmail
I have a local development server (centos) which I develop a number of websites on. Occasionally I need to test email sending scripts.
I want to avoid the development server from sending emails to anyone who doesn't have an email address with a particular domain (ie: jon@mydomain.com, mary@mydomain.com, etc). So, I would like to create a white list or rule on the server which prevents emails being sent to any email address that doesn't match mydomain.com.
I'm currently using PHP's built-in mail() function. But I imagine this is something more on the server level and I would like something that will manage ANY emails sent out from the server from any program/app/script/etc.
I can confirm that PHP is using /usr/sbin/sendmail.sendmail
linux centos php email sendmail
linux centos php email sendmail
edited Sep 17 '13 at 12:51
David
asked Sep 17 '13 at 10:55
DavidDavid
2491821
2491821
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
PHP mail()
function sends messages according to MTA set as sendmail_path
value in php.ini
, by default, it's set to following:
sendmail_path = /usr/sbin/sendmail -t -i
on some systems it's a symlink to the binary of MTA, in my case it's sendmail-compatible binary of postfix MTA package, in other case it might be sendmail or qmail or whatever you use:
[root@giomacdesk ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 ივლ 3 11:33 /usr/sbin/sendmail -> /etc/alternatives/mta
[root@giomacdesk ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 ივლ 3 11:33 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
So, according to this you can:
A. change sendmail_path
to your custom script, write parser and filter messages accordingly. This will affect only outgoing messages sent via PHP mail()
where sendmail_path
was changed.
B. change configuration of mail server - this will affect all messages sent via MTA of your server, to do this you must check what is your server and configure it accordingly
In case of postfix:
add following to the /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport_maps
create file
/etc/postfix/transport_maps
with following content:
alloweddomain.com :
* discard:
hash: run
postmap /etc/postfix/transport_maps
restart postfix
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
add a comment |
here is how I managed to do it. In Sendmail, you need to modify the mailertable. Add the following:
alloweddomainname.com alloweddomainname.com
. error:
This will essentially send any emails to @alloweddomainname.com and error for anything else.
Have you considered using "catchall" local mailbox in default mailertable route?. local:catchall
– AnFi
Sep 17 '13 at 14:27
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
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%2fserverfault.com%2fquestions%2f539520%2fhow-to-configure-sendmail-to-only-send-to-specified-domains%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
PHP mail()
function sends messages according to MTA set as sendmail_path
value in php.ini
, by default, it's set to following:
sendmail_path = /usr/sbin/sendmail -t -i
on some systems it's a symlink to the binary of MTA, in my case it's sendmail-compatible binary of postfix MTA package, in other case it might be sendmail or qmail or whatever you use:
[root@giomacdesk ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 ივლ 3 11:33 /usr/sbin/sendmail -> /etc/alternatives/mta
[root@giomacdesk ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 ივლ 3 11:33 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
So, according to this you can:
A. change sendmail_path
to your custom script, write parser and filter messages accordingly. This will affect only outgoing messages sent via PHP mail()
where sendmail_path
was changed.
B. change configuration of mail server - this will affect all messages sent via MTA of your server, to do this you must check what is your server and configure it accordingly
In case of postfix:
add following to the /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport_maps
create file
/etc/postfix/transport_maps
with following content:
alloweddomain.com :
* discard:
hash: run
postmap /etc/postfix/transport_maps
restart postfix
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
add a comment |
PHP mail()
function sends messages according to MTA set as sendmail_path
value in php.ini
, by default, it's set to following:
sendmail_path = /usr/sbin/sendmail -t -i
on some systems it's a symlink to the binary of MTA, in my case it's sendmail-compatible binary of postfix MTA package, in other case it might be sendmail or qmail or whatever you use:
[root@giomacdesk ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 ივლ 3 11:33 /usr/sbin/sendmail -> /etc/alternatives/mta
[root@giomacdesk ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 ივლ 3 11:33 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
So, according to this you can:
A. change sendmail_path
to your custom script, write parser and filter messages accordingly. This will affect only outgoing messages sent via PHP mail()
where sendmail_path
was changed.
B. change configuration of mail server - this will affect all messages sent via MTA of your server, to do this you must check what is your server and configure it accordingly
In case of postfix:
add following to the /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport_maps
create file
/etc/postfix/transport_maps
with following content:
alloweddomain.com :
* discard:
hash: run
postmap /etc/postfix/transport_maps
restart postfix
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
add a comment |
PHP mail()
function sends messages according to MTA set as sendmail_path
value in php.ini
, by default, it's set to following:
sendmail_path = /usr/sbin/sendmail -t -i
on some systems it's a symlink to the binary of MTA, in my case it's sendmail-compatible binary of postfix MTA package, in other case it might be sendmail or qmail or whatever you use:
[root@giomacdesk ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 ივლ 3 11:33 /usr/sbin/sendmail -> /etc/alternatives/mta
[root@giomacdesk ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 ივლ 3 11:33 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
So, according to this you can:
A. change sendmail_path
to your custom script, write parser and filter messages accordingly. This will affect only outgoing messages sent via PHP mail()
where sendmail_path
was changed.
B. change configuration of mail server - this will affect all messages sent via MTA of your server, to do this you must check what is your server and configure it accordingly
In case of postfix:
add following to the /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport_maps
create file
/etc/postfix/transport_maps
with following content:
alloweddomain.com :
* discard:
hash: run
postmap /etc/postfix/transport_maps
restart postfix
PHP mail()
function sends messages according to MTA set as sendmail_path
value in php.ini
, by default, it's set to following:
sendmail_path = /usr/sbin/sendmail -t -i
on some systems it's a symlink to the binary of MTA, in my case it's sendmail-compatible binary of postfix MTA package, in other case it might be sendmail or qmail or whatever you use:
[root@giomacdesk ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 ივლ 3 11:33 /usr/sbin/sendmail -> /etc/alternatives/mta
[root@giomacdesk ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 ივლ 3 11:33 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
So, according to this you can:
A. change sendmail_path
to your custom script, write parser and filter messages accordingly. This will affect only outgoing messages sent via PHP mail()
where sendmail_path
was changed.
B. change configuration of mail server - this will affect all messages sent via MTA of your server, to do this you must check what is your server and configure it accordingly
In case of postfix:
add following to the /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport_maps
create file
/etc/postfix/transport_maps
with following content:
alloweddomain.com :
* discard:
hash: run
postmap /etc/postfix/transport_maps
restart postfix
edited Sep 17 '13 at 12:46
answered Sep 17 '13 at 12:37
GioMacGioMac
4,02921634
4,02921634
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
add a comment |
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I can confirm that it's /usr/sbin/sendmail.sendmail
– David
Sep 17 '13 at 12:52
I'd make life easier - install postfix, remove sendmail, enable postfix:
yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
I'd make life easier - install postfix, remove sendmail, enable postfix:
yum install postfix -y;yum remove sendmail;chkconfig postfix on;service postfix start
– GioMac
Sep 17 '13 at 12:55
add a comment |
here is how I managed to do it. In Sendmail, you need to modify the mailertable. Add the following:
alloweddomainname.com alloweddomainname.com
. error:
This will essentially send any emails to @alloweddomainname.com and error for anything else.
Have you considered using "catchall" local mailbox in default mailertable route?. local:catchall
– AnFi
Sep 17 '13 at 14:27
add a comment |
here is how I managed to do it. In Sendmail, you need to modify the mailertable. Add the following:
alloweddomainname.com alloweddomainname.com
. error:
This will essentially send any emails to @alloweddomainname.com and error for anything else.
Have you considered using "catchall" local mailbox in default mailertable route?. local:catchall
– AnFi
Sep 17 '13 at 14:27
add a comment |
here is how I managed to do it. In Sendmail, you need to modify the mailertable. Add the following:
alloweddomainname.com alloweddomainname.com
. error:
This will essentially send any emails to @alloweddomainname.com and error for anything else.
here is how I managed to do it. In Sendmail, you need to modify the mailertable. Add the following:
alloweddomainname.com alloweddomainname.com
. error:
This will essentially send any emails to @alloweddomainname.com and error for anything else.
answered Sep 17 '13 at 13:47
DavidDavid
2491821
2491821
Have you considered using "catchall" local mailbox in default mailertable route?. local:catchall
– AnFi
Sep 17 '13 at 14:27
add a comment |
Have you considered using "catchall" local mailbox in default mailertable route?. local:catchall
– AnFi
Sep 17 '13 at 14:27
Have you considered using "catchall" local mailbox in default mailertable route?
. local:catchall
– AnFi
Sep 17 '13 at 14:27
Have you considered using "catchall" local mailbox in default mailertable route?
. local:catchall
– AnFi
Sep 17 '13 at 14:27
add a comment |
Thanks for contributing an answer to Server Fault!
- 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%2fserverfault.com%2fquestions%2f539520%2fhow-to-configure-sendmail-to-only-send-to-specified-domains%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