How to catch outgoing email when using a SMART_HOST relay
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to catch outgoing email when using a SMART_HOST relay
Our organization has a website where users can send messages via a Contact Us page.those messages are sent to various recipients. The webserver uses sendmail, but is configures to use the company's Exchange server as the SMART_HOST email relay. Therefore, messages sent from the webpage app (jsp) never route through the local sendmail. I conclude this because I have a bcc-milter which saves a copy of all email to a mail folder and none of the webpape app emails go to this folder.
What can I do to route messages through the local Sendmail server first so Spamassassin can catch and remove the endless stream of messages about Casinos and SEO services?
Our organization has a website where users can send messages via a Contact Us page.those messages are sent to various recipients. The webserver uses sendmail, but is configures to use the company's Exchange server as the SMART_HOST email relay. Therefore, messages sent from the webpage app (jsp) never route through the local sendmail. I conclude this because I have a bcc-milter which saves a copy of all email to a mail folder and none of the webpape app emails go to this folder.
What can I do to route messages through the local Sendmail server first so Spamassassin can catch and remove the endless stream of messages about Casinos and SEO services?
I think you posted your own solution; tell the web page to route to your sendmail server, and point it to the Exchange server to go out.
I did try that and it sort-of works. However, there's a problem. I do this (sendmail and mailx):
Code:
mail -r joe@xmail.com -s "contact me" contactus < msg.txt
The /etc/mail/aliases file has:
Code:
contactus: contactus@mydom.org
So, the message to local contactus does route through the webserver sendmail, and does run through the local milters, and does forward to contactus@mydom.org. mydom.org is on MS Exchange, and he message does get delivered to joe@xmail.com. So far so good. The problem is that if the recipients on the contactus.mydom.org distribution list do a Reply-All, the To: addresses end up:
Code:
To: joe@xmail.com; contactus@webserver.hprs.local
The To: address is what happens when routing it through the webserver email. Somehow, I need to be able to change this To: address (originally the sender) to contactus@mydom.org.
I did try that and it sort-of works. However, there's a problem. I do this (sendmail and mailx):
Code:
mail -r joe@xmail.com -s "contact me" contactus < msg.txt
The /etc/mail/aliases file has:
Code:
contactus: contactus@mydom.org
So, the message to local contactus does route through the webserver sendmail, and does run through the local milters, and does forward to contactus@mydom.org. mydom.org is on MS Exchange, and he message does get delivered to joe@xmail.com. So far so good. The problem is that if the recipients on the contactus.mydom.org distribution list do a Reply-All, the To: addresses end up:
Code:
To: joe@xmail.com; contactus@webserver.hprs.local
The To: address is what happens when routing it through the webserver email. Somehow, I need to be able to change this To: address (originally the sender) to contactus@mydom.org.
More info ... I've tried setting .mailrc in the tomcat home directory:
Code:
account portal {
set from="contactus@mydom.org (Members Website)"
set hostname=mydom.org
}
set from=contactus@mydom.org
and I've tried manually sending as: mail -A portal -r mfoley@novatec-inc.com -s "test message" contactus < msgBody.txt, but I still generate contactus@webserver.hprs.local when the recipient does a reply-all.
How to change the sender's email address with sendmail?
More info ... I've tried setting .mailrc in the tomcat home directory:
Code:
account portal {
set from="contactus@mydom.org (Members Website)"
set hostname=mydom.org
}
set from=contactus@mydom.org
and I've tried manually sending as: mail -A portal -r mfoley@novatec-inc.com -s "test message" contactus < msgBody.txt, but I still generate contactus@webserver.hprs.local when the recipient does a reply-all.
How to change the sender's email address with sendmail?
Also, I'd look into the web-code itself, to see how it's sending mail, to see if things can be tweaked there, which may be an easier solution. You might be able to set things there, which would affect only one form/function/page, rather than your entire sendmail server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.