Solved

EXIM: How can I route emails originating from a PHP script through an IP, and emails from SMTP/IMAP through another IP?

Posted on 2016-08-23
4
46 Views
Last Modified: 2016-09-14
Hi,

Is it possible to make exim route all email originating from php scripts (/usr/sbin/sendmail) through RouteA, and route all email originating from smtp/imap connections through RouteB?

I'm running exim on a cpanel server, and every email originated from PHP scripts have a header called "X-PHP-Script". Is it possible to make exim filter emails that have this header and deliver these emails using a particular IP on my server?

Thank you
0
Comment
Question by:Vinicius Munich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 40

Accepted Solution

by:
noci earned 500 total points (awarded by participants)
ID: 41769354
You can configure exim to listen for 127.0.0.1:1125   (choose any port you like just not a regular one).
And configure sending your PHP apps to send SMTP to this port.
In a router you can filter on the source port. (For a good example check out the amavisd / exim configurations, there the default router picks up mail, forwards it to amavis and the receives again from amavis for normal processing...)
1
 

Author Comment

by:Vinicius Munich
ID: 41769860
Thanks for the suggestion @noci. Unfortunately that wouldn't work for me. I run a small shared hosting, and often users will use outdated or vulnerable scripts, so they get abused. Attackers might upload or run scripts that sends a lot of spam.

Since these spamming PHP scripts use /usr/sbin/sendmail to send email, I can't force them to use a custom port. I'm trying to route email sent using /usr/sbin/sendmail through one route and SMTP email through another route so that if RouteA gets blacklisted because of spammers, it won't affect the emails sent from SMTP, because it uses RouteB.

It doesn't have to be routes necessarily. If I could send email from php scripts through one IP, and SMTP email through another IP, that would work too.

Would you have another suggestion?

Thank you
0
 
LVL 40

Assisted Solution

by:noci
noci earned 500 total points (awarded by participants)
ID: 41770637
You can allways replace /usr/sbin/sendmail with a script that does nothing.... or just log, or rings alarmbells.
And have the legit scripts send mail through localhost on a specific, non SMTP related  port.

Sendmail only is a symbolic link to exim but it can be any script.
Also check /usr/lib/sendmail though.... should also be a symlink to /usr/sbin/sendmail
1
 
LVL 40

Expert Comment

by:noci
ID: 41797502
Sufficient info in both answers
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question