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
20 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
  • 3
4 Comments
 
LVL 39

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 39

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 39

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The purpose of this video is to demonstrate how to set up Lists in Mailchimp. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchimp account. : Click on Lists. Click on Create List Button : Choose the desi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now