LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-15-2024, 12:18 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Rep: Reputation: 177Reputation: 177
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?

Last edited by mfoley; 04-15-2024 at 12:44 PM.
 
Old 04-15-2024, 04:13 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,656

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by mfoley View Post
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.
 
Old 05-02-2024, 01:02 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Original Poster
Rep: Reputation: 177Reputation: 177
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.

Last edited by mfoley; 05-02-2024 at 01:18 PM.
 
Old 05-02-2024, 01:44 PM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,564

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by mfoley View Post
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?
 
Old 05-02-2024, 02:02 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,656

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by mfoley View Post
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?
May want to look into the use of a genericstable: https://www.madboa.com/geek/sendmail-genericstable/

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.
 
  


Reply

Tags
child, exiting, pid, spamassassin



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
systemd service failed to start with errror : “main process exited, code=exited, status=3/NOTIMPLEMENTED” prcm Red Hat 10 02-25-2022 02:15 AM
tomcat.service: main process exited, code=exited, status=127/n/a Sam2412 Linux - Server 0 10-14-2021 11:50 AM
Parent, Child processing with signaling............ Iyyaaz Linux - Kernel 4 01-16-2011 09:58 PM
Under which circumstances a child process creates another child process using fork? mitsulas Programming 3 12-08-2009 08:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration