Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
Blog

How to Restrict Outgoing SMTP With Exim on a VPS

Use network egress rules, local submission restrictions and Exim ACL rate limits together to stop direct SMTP abuse while preserving reliable smarthost delivery.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reliable way to stop scripts or compromised accounts from sending mail directly is to combine three controls: block unauthorized egress on TCP port 25 at the VPS or provider boundary, restrict local submission so approved services must use Exim, and enforce Exim ACL and rate-limit policies. Keep Exim able to hand mail to an approved smarthost over authenticated submission (usually port 587 or 465), then verify both rejection and legitimate delivery before making the policy permanent.

What the three-layer design protects

Outgoing SMTP abuse usually occurs in one of two ways. A compromised process opens a direct connection to a remote mail server on TCP port 25, bypassing your MTA entirely, or an application submits locally at a rate that overwhelms your queue and damages the server’s reputation. A single Exim setting cannot reliably stop both paths.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use these layers together:

  • Network egress control: deny direct outbound TCP/25 except through an explicitly approved relay path. This is the boundary that still works if an attacker never contacts Exim.
  • Local submission control: permit Exim, Mailman and root (or specifically approved service accounts) to connect to remote SMTP servers. On cPanel, SMTP Restrictions is designed for this purpose.
  • Exim policy: use ACLs to reject suspicious SMTP commands and the ratelimit condition to throttle abusive activity across connections and over time.

The result is not simply “port 25 is closed.” Applications continue to deliver mail by authenticating to the local Exim service, while Exim alone sends onward through the approved smarthost.

Decide what traffic is allowed before changing Exim

Separate submission from server-to-server delivery

Port 25 is traditionally used for SMTP server-to-server delivery. Submission clients should instead use authenticated STARTTLS on port 587 or SMTPS on port 465. The Debian Project recommends those submission ports instead of plain SMTP on port 25 for practical deployments. Your policy should therefore distinguish:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Connection Purpose Recommended policy
Application to local Exim Message submission from a website, game panel, cron job or service Allow only the local listener and approved credentials; require the application to use Exim rather than opening its own remote socket.
Exim to smarthost Outbound handoff by the MTA Allow the smarthost’s hostname or IP and its submission port, normally 587 or 465, with authentication configured in Exim.
Unapproved process to the Internet on TCP/25 Direct delivery or abuse bypassing Exim Deny at the VPS or provider egress boundary.
Exim to arbitrary Internet hosts on TCP/25 Direct delivery without a relay Deny unless your operational policy explicitly requires direct delivery and you can restrict it to the MTA.

Record the approved relay hostname, destination port, authentication method, sender domains and expected message volume. Those decisions become the firewall exception, Exim route and ACL keys. Do not begin with a rate number copied from another server; Exim’s specification does not define one universal safe threshold.

Block direct outbound port 25 at the VPS boundary

Use the provider control when available

Many VPS providers block outbound TCP/25 by default. If yours does, leave that block in place and configure Exim to use a smarthost. If it does not, create an egress rule that rejects TCP/25 for the server, while permitting only the approved relay path. A provider-level rule is preferable because a local process cannot remove it after a compromise.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The exact firewall interface and rule syntax vary by distribution and hosting provider. Apply the rule in the platform’s outbound or network-security controls, and document whether it is a reject or silent drop. Then check the provider’s effective policy from the VPS; a rule shown in a dashboard is not proof that the packet is blocked.

Keep the exception narrow

  • Permit only the smarthost address or addresses you actually use.
  • Permit only the smarthost’s configured submission port, such as 587 or 465.
  • Do not create a broad “allow all SMTP” exception for the entire VPS.
  • If the relay publishes multiple addresses, include the documented set and monitor for changes.

A port-25 egress block can break old applications that contain a remote SMTP server and port 25 in their settings. Plan to change those applications to the local Exim host or to authenticated submission before enforcing the rule.

Enable local submission restrictions in cPanel/WHM

Turn on SMTP Restrictions

  1. Sign in to WHM with an administrator account.
  2. Open Security Center → SMTP Restrictions.
  3. Enable the restriction and save the change.
  4. Re-test any service that sends mail, including websites, scheduled jobs and mailing lists.

cPanel documents that this setting allows only the mail transport agent, Mailman and the root user to connect to remote SMTP servers. Ordinary users and services therefore cannot bypass Exim by opening their own outbound SMTP connection. Applications should submit to the cPanel server as their SMTP host and supply a valid address and password.

Add explicit IP policies when necessary

For additional control, cPanel provides IP deny lists at Service Configuration → Exim Configuration Manager → Access Lists. Use these lists for known abusive or untrusted sources, not as a substitute for the outbound egress block. An IP list affects Exim’s behavior; it does not stop a process that bypasses Exim and connects directly to the Internet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Account for service identities

Inventory every legitimate sender before enabling the restriction. A web application may run as a per-account Unix user, while a monitoring daemon may run under its own service identity. Give each sender one of two supported paths: submit through Exim using authenticated SMTP, or be explicitly approved as a local service that Exim can identify. Avoid granting broad root privileges merely to preserve an old mail script.

Configure Exim to relay through a smarthost

Use an alternate submission port

In a Debian Exim smarthost configuration, an alternate port is written after a double colon. A relay on port 587 is represented conceptually as:

smarthost.example::587

The hostname and port select the route; authentication is configured separately in Exim’s credential section. Store relay credentials with permissions that prevent application users from reading them, and use the TLS mode required by the relay. Port 587 normally means authenticated SMTP with STARTTLS; port 465 means SMTPS with TLS established when the connection opens.

Align the route with the firewall

Do not configure Exim for port 587 while the egress policy permits only port 465, or vice versa. The route, credential stanza and provider rule must describe the same destination. If the relay has both names and addresses, verify that DNS resolution and the firewall exception cover the values Exim will actually use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make applications use Exim

Change each application to submit to the local Exim listener, using the account’s SMTP credentials and the server name appropriate for that installation. Do not leave a hard-coded remote host on port 25 in a plugin, environment variable or scheduled script. A local submission test should produce an Exim log entry followed by a smarthost handoff; it should not show the application establishing an external TCP/25 session.

Use Exim ACLs to reject and throttle abuse

Where ACLs apply

Exim ACLs are declared under begin acl. They can control SMTP commands from network clients and local SMTP submissions made through Exim’s -bs interface. Place a check at the stage that matches the policy you want to enforce:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
  • MAIL: reject or delay a sender before recipients are accepted.
  • RCPT: apply recipient, domain or per-identity policy.
  • DATA: inspect the message transaction after recipients have been accepted.
  • Non-SMTP submission: protect locally generated messages that enter through a non-network path, where appropriate for your configuration.

Log each decision. A clear policy message and a corresponding log record let you distinguish an intentional abuse rejection from a DNS, TLS or relay-delivery failure.

Understand the newer ratelimit condition

The Exim ratelimit ACL condition measures activity across concurrent and sequential connections. That makes it suitable for detecting an account or service that opens many short sessions, a pattern that older per-session controls do not capture. Older smtp_ratelimit_* settings are session-oriented and should not be treated as an equivalent global quota.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start with a key that identifies the sender

A conceptual ACL pattern is:

begin acl

acl_check_mail:
  deny  ratelimit = 100 / 1h / strict / $authenticated_id
        message = submission rate exceeded
  accept

This means “deny when the authenticated identity reaches the illustrated rate,” but it is not a universal copy-and-paste configuration. The appropriate key, ACL hook, authentication variable and generated macros differ between standalone Exim and panel-managed builds. If unauthenticated local submissions are possible, $authenticated_id may be empty or unsuitable; choose a key that reliably separates the service or account you intend to limit.

The value of 100 messages per hour above is only an example threshold. Derive a production limit from normal application volume, alerting requirements, queue behavior and the relay’s own policy. Start in a logging or deliberately low-impact test mode where your build supports it, then tune the limit after observing legitimate bursts such as password resets or game-server notifications.

Choose the rejection point carefully

Rejecting at MAIL stops the transaction early and avoids accepting recipients that cannot be delivered. A DATA-stage check can incorporate message-level information but may consume more resources before rejection. Whichever stage you choose, make the policy message clear enough for the submitting application and log the identity, decision and counter key without exposing credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate generated configuration before reload

  1. Render the effective configuration. Panel-managed Exim installations generate files and macros; inspect the rendered result rather than assuming that an edited template is active.
  2. Run Exim’s syntax check. Do this before reloading. A malformed ACL or router can stop Exim from accepting mail.
  3. Review the route. Confirm the smarthost name, alternate port, TLS requirement and authentication lookup are all present in the effective configuration.
  4. Reload only after validation. Keep an administrative session available so you can restore the previous configuration if the reload fails.
  5. Watch the log during a controlled submission. Verify that Exim accepts the message and records a handoff attempt to the intended relay.

Do not assume that a standalone Debian recipe applies unchanged to cPanel. Panel updates can regenerate Exim files, and the supported customization points and macro names may differ.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Verification and failure testing

Test the blocked path

From an unapproved service account, attempt a controlled outbound TCP/25 connection to a test destination that you administer or are authorized to use. The attempt should be rejected by the egress policy. Repeat after a firewall or provider change; an old connection can make a newly blocked rule appear ineffective.

Test the approved path

Submit a message through the local Exim listener with valid application credentials. Confirm all of the following:

  • The application connects to the local submission endpoint, not a remote host on port 25.
  • Exim records an accepted submission with the expected authenticated identity.
  • Exim opens the smarthost connection on the configured submission port.
  • The relay accepts the handoff and the message leaves the queue.

Exercise the rate policy

In a test window, send enough controlled submissions to cross the configured threshold. Verify that Exim returns the policy message, records the rate-limit decision and leaves unrelated identities unaffected. Then test queue recovery and legitimate alerts after the limit is restored.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common breakages

Applications report connection refused or timeout

First determine whether the application is still targeting a remote port 25. If so, change it to the local Exim host or to the approved authenticated submission endpoint. If it already uses Exim, inspect the local listener, credentials and SMTP authentication policy before changing the firewall.

Exim accepts mail but cannot deliver it

Check the effective smarthost route, alternate port, DNS result, TLS negotiation and credential lookup. A successful local submission proves only that Exim accepted the message; it does not prove that the relay connection or authentication succeeded. The Exim log should identify whether the failure occurred during connection, TLS, authentication or remote rejection.

Legitimate bursts are rejected

Review the rate key and window. A key that groups several applications together can exhaust the quota unexpectedly, while a key that is too granular may fail to contain one compromised account. Increase or separate limits based on measured legitimate volume rather than deleting the ACL. Keep alerting in place so a higher limit does not hide abuse.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

SMTP Restrictions breaks a service

Identify the Unix user or daemon that opened the remote connection. Reconfigure it to authenticate to Exim, then retest. Avoid bypassing the restriction globally; its purpose is to make Exim the single controlled egress point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The firewall appears to do nothing

Check the provider-level rule, local firewall order, IPv4 versus IPv6 behavior and existing long-lived connections. Test both address families if the VPS has IPv6. Also verify that the smarthost exception is not broader than intended.

Operational checklist

  • Document the approved relay hostname, addresses, port and credentials owner.
  • Deny unauthorized outbound TCP/25 at the provider or VPS boundary.
  • Enable cPanel SMTP Restrictions when using cPanel/WHM.
  • Configure all applications to submit through Exim with proper credentials.
  • Add Exim ACL checks at the stage that matches your policy.
  • Use ratelimit with a sender key that remains meaningful across connections.
  • Log accepted submissions, relay handoffs and policy rejections.
  • Syntax-check and render panel-generated configuration before every reload.
  • Test blocked direct delivery, approved submission, relay handoff and rate-limit behavior.
  • Re-test after provider, panel or Exim updates because generated configuration and network policy can change.

Which control should you use?

Goal Primary control Why it matters
Stop a compromised process from bypassing Exim Provider/VPS egress deny for TCP/25 Works even when the process never uses the MTA.
Prevent users and services from opening remote SMTP sessions cPanel SMTP Restrictions or equivalent local policy Limits remote SMTP access to Exim, Mailman and root in cPanel’s documented model.
Slow a legitimate-looking but abusive sender Exim ACL with ratelimit Measures activity across multiple connections and provides a policy response.
Continue sending when port 25 is unavailable Authenticated smarthost on 587 or 465 Uses documented submission ports while retaining Exim as the controlled MTA.

Frequently Asked Questions

Will blocking outbound port 25 stop applications from sending mail?

It will stop direct Internet delivery on that port. Applications can still send when they submit to local Exim, which then relays through the configured smarthost on authenticated port 587 or 465.

Does cPanel SMTP Restrictions replace an outbound firewall rule?

No. SMTP Restrictions prevents ordinary users and services from connecting directly to remote SMTP servers through the cPanel policy. A provider or VPS egress rule is still the control that blocks a process attempting to bypass Exim entirely.

Is the 100 messages per hour value a recommended Exim limit?

No. It is an illustrative ACL threshold. Set the limit from your application’s normal volume, relay policy and alerting needs; Exim does not publish one universal safe number.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why can an Exim ACL affect local scripts as well as network clients?

Exim ACLs govern SMTP commands, including submissions made by local processes through Exim’s -bs interface, so the same policy can cover both connection types when placed at the appropriate ACL stage.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.