Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Set Up a Postfix Mail Relay with Mailgun on Ubuntu

A complete Ubuntu guide to using Postfix as a secure Mailgun smarthost, including port selection, SASL credentials, TLS policy, relay restrictions, testing, and failure diagnosis.
Length13 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure Ubuntu’s Postfix service as a restricted smarthost, and it will hand outgoing messages to Mailgun instead of connecting directly to recipient mail servers. The practical default is Mailgun’s [smtp.mailgun.org]:587 endpoint with SASL authentication and STARTTLS. Store the sending-domain SMTP credential in a root-only password map, require authenticated or trusted local senders, and verify the result with a real message, the Postfix queue, and the mail logs.

This arrangement gives local applications a standard SMTP service while Mailgun handles the remote SMTP delivery. It does not make the Ubuntu server an open relay: destinations that are not authorized by your local policy must be rejected.

As an Amazon Associate I earn from qualifying purchases.

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.

What the relay changes

Without a relay host, Postfix attempts to deliver remote mail directly to each recipient domain’s MX server. With relayhost configured, Postfix sends every remote message to the specified SMTP server instead. Mailgun then accepts the authenticated submission and performs the onward delivery.

  • Applications submit mail to Postfix on the Ubuntu host.
  • Postfix authenticates to Mailgun with the SMTP credentials belonging to the sending domain.
  • Mailgun receives the message over the selected submission port and handles remote delivery.
  • Postfix retains queue and status information locally, so failures remain visible in its logs.

The relay host setting is specifically designed for this smarthost pattern: it forces remote messages to the named server rather than having Postfix deliver to destination MX records itself.

#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.

Prerequisites and decisions

  • An Ubuntu server with sudo access.
  • A resolvable hostname for the server. A stable hostname makes mail-service diagnostics and TLS troubleshooting easier.
  • A Mailgun sending domain with SMTP credentials created for that domain.
  • Outbound TCP access from the server to the Mailgun submission port you choose.
  • A local application, command-line mailer, or test utility that can submit a message to Postfix.

Mailgun manages SMTP credentials per sending domain. The password for the Mailgun control panel is not the password that belongs in Postfix. Obtain the SMTP username and password shown for the specific sending domain instead.

Confirm the sending domain is configured and authorized in Mailgun before testing. Use a sender address at that domain, and choose a recipient you control so you can verify both the SMTP transaction and receipt. The Ubuntu hostname should resolve consistently in local DNS and, where applicable, public DNS; inconsistent names make log correlation and certificate troubleshooting harder even though Mailgun remains the outbound relay.

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

Install Postfix and select a smarthost configuration

Update Ubuntu’s package metadata and install Postfix:

sudo apt update
sudo apt install postfix

During package configuration, select the smarthost-oriented option (usually labelled Internet with smarthost) when the installer asks how mail should be sent. This expresses the intended design: local programs can submit mail, while outbound delivery is handed to another SMTP server. If the package was already installed with a different choice, the files can still be corrected manually in the following steps.

Ubuntu’s Postfix package uses a default chroot arrangement for some service processes. Do not disable that arrangement merely to make Mailgun work; first apply the provider and TLS settings, then inspect logs if a process-specific problem appears.

Configure the Mailgun relay in main.cf

Edit the main Postfix configuration:

sudo editor /etc/postfix/main.cf

Set the relay and SMTP authentication parameters as follows:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
relayhost = [smtp.mailgun.org]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_tls_note_starttls_offer = yes

The square brackets in [smtp.mailgun.org]:587 tell Postfix to use that host and port as the relay endpoint rather than looking up a destination MX record for the relay name. The key in the password map must match the relay host, including the brackets and port.

The noanonymous setting prevents Postfix from selecting an anonymous SASL mechanism. Authentication is enabled, and the password map supplies the account that Mailgun issued for the sending domain.

Keep one authoritative relayhost declaration. Duplicate settings later in main.cf can override earlier lines and make troubleshooting confusing. Use postconf after editing to see the value Postfix actually loaded rather than relying on what appears in an editor.

Create and protect the SASL password map

Create the plaintext source file with one line containing the exact relay key, followed by the SMTP username and password:

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
sudo editor /etc/postfix/sasl_passwd
[smtp.mailgun.org]:587 SMTP_USERNAME:SMTP_PASSWORD

Replace SMTP_USERNAME and SMTP_PASSWORD with the credentials for the Mailgun sending domain. Do not use the control-panel password. The colon separates the username from the password; if a password itself contains characters that are meaningful to your editing or deployment process, enter it exactly as Mailgun supplies it and avoid exposing it in shell history.

Compile the map and restrict both files:

sudo postmap /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 600 /etc/postfix/sasl_passwd

Postfix reads the generated database file, while the original file remains a plaintext secret. Keep it readable only by root, remove accidental copies from shared directories and shell transcripts, and ensure backups do not make the credential world-readable. When the password changes, edit the source file, run postmap again, and reload or restart Postfix so the new map is used.

Do not put the password directly in main.cf, a unit-file command line, or a world-readable configuration-management template. Those locations commonly appear in support bundles, process listings, or backups. After a rotation, test a fresh message and remove obsolete map copies so an old credential cannot be recovered from an unprotected directory.

Keep the Ubuntu host from becoming an open relay

Authentication to Mailgun and authorization for clients connecting to your Ubuntu server are separate controls. Limit who may submit mail locally and reject destinations that are not authorized. A typical recipient restriction order is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

The final reject_unauth_destination clause is essential. It prevents an unauthenticated client from using your Postfix instance to relay to arbitrary domains. The earlier clauses permit authenticated SMTP clients and hosts listed in Postfix’s trusted mynetworks setting.

Review mynetworks rather than expanding it casually. Include only loopback addresses and private application networks that you actually control. Do not add the whole internet, a broad public address range, or an untrusted cloud network just to make a test succeed. If external users must submit mail, require SMTP authentication and keep the unauthenticated-destination rejection in place.

Test this boundary deliberately after setup: submit one message from an approved local application, then try an unauthorized destination from an untrusted client or network. The second attempt should be rejected before Postfix queues it. A successful local submission alone does not prove relay protection.

Choose a Mailgun submission port and TLS policy

Mailgun documents four SMTP ports. Their encryption and reachability characteristics differ:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Port Connection mode Operational consideration Postfix implication
25 Plain SMTP initially, with STARTTLS available Frequently blocked or throttled by hosting providers Use only when outbound access is dependable and policy allows it
465 Implicit TLS from the beginning of the connection Requires a client configuration for immediate TLS Not interchangeable with the STARTTLS settings shown for port 587
587 Plain SMTP initially, upgraded with STARTTLS Mailgun’s practical default when port 25 is restricted Use [smtp.mailgun.org]:587 with the configuration above
2525 Plain SMTP initially, with STARTTLS available An alternative when common SMTP ports are filtered Change both relayhost and the password-map key to port 2525

Port 587 is generally the best starting point because it supports authenticated submission with STARTTLS and is less likely than port 25 to be blocked. If you select 2525 instead, use a matching key such as [smtp.mailgun.org]:2525 in both main.cf and sasl_passwd. A mismatch causes authentication lookup failures even when the username and password are correct.

Port 465 is not a drop-in substitution for this configuration. It starts with implicit TLS, whereas the sample expects a plaintext greeting followed by STARTTLS. Select it only when your Postfix version and chosen SMTP client settings explicitly support that mode. Ports 25 and 2525 use the same STARTTLS style as 587, but their network reachability and provider policies may differ.

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)

The sample uses smtp_tls_security_level = may. With that policy, Postfix attempts to upgrade the connection when the server offers STARTTLS, but delivery can fall back if TLS negotiation is unavailable. For a stricter deployment, change the setting to:

smtp_tls_security_level = encrypt

Required encryption changes the failure behavior: if TLS cannot be established, Postfix does not deliver the message. Test certificate validation, firewall reachability, and the remote endpoint before enforcing this setting in production. Optional TLS is more tolerant of a broken upgrade path, but it can permit plaintext fallback, so the choice is a security-policy decision rather than a cosmetic preference.

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

Ensure the Ubuntu CA bundle is installed and that Postfix can locate it. A common Ubuntu CA file is:

/etc/ssl/certs/ca-certificates.crt

If certificate errors occur, check that the CA package is present, the server clock is accurate, and the hostname used for the SMTP connection matches the certificate validation path. Do not “fix” a certificate failure by disabling validation or switching to an unauthenticated relay.

Check the resulting configuration before restarting

After saving main.cf and the password map, ask Postfix to validate its files:

sudo postfix check

A successful check produces no error output. Confirm the effective values for the settings that matter:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo postconf relayhost smtp_sasl_auth_enable smtp_sasl_password_maps smtp_sasl_security_options smtp_tls_security_level smtp_tls_note_starttls_offer smtpd_recipient_restrictions

Restart the service so the new configuration and map are loaded:

sudo systemctl restart postfix
sudo systemctl --no-pager --full status postfix

The status output should show an active Postfix service. If it fails, run postfix check again and read the service journal before attempting another restart; syntax errors, ownership problems, and malformed map entries are usually reported there.

Send a test message through the local Postfix path

A useful test exercises the same path that your application will use: submit to the local Postfix service, then let Postfix authenticate to Mailgun. For a simple command-line test, provide a sender, recipient, subject, and body through sendmail:

printf 'From: [email protected]: [email protected]: Postfix Mailgun relay testnnThis is a relay test.n' | sendmail -v [email protected]

Use a sender address belonging to the sending domain configured in Mailgun and a recipient address you control. The verbose output shows whether the local submission was accepted; remote acceptance is confirmed in the Postfix log and in Mailgun’s message records, not solely by the local command returning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

For a direct SMTP diagnostic, Mailgun documents a Swaks pattern that supplies the server, SMTP username, SMTP password, recipient, subject, and body. Keep the password out of shell history when possible by entering it through an environment variable or a protected prompt:

read -r SMTP_USERNAME
read -r -s SMTP_PASSWORD
swaks --server smtp.mailgun.org:587 
  --auth LOGIN 
  --auth-user "$SMTP_USERNAME" 
  --auth-password "$SMTP_PASSWORD" 
  --from [email protected] 
  --to [email protected] 
  --header 'Subject: Direct Mailgun SMTP test' 
  --body 'Testing Mailgun SMTP authentication.'

The direct test isolates Mailgun credentials and network access. The local sendmail test additionally proves that your application-to-Postfix path works. Run both only when you need to distinguish those two layers.

Verify the queue and logs

Immediately after submitting the test, inspect the queue and recent service messages:

mailq
sudo journalctl -u postfix -n 100 --no-pager
sudo tail -n 100 /var/log/mail.log

A successful relay normally shows SASL authentication to the Mailgun endpoint followed by acceptance of the remote message. The queue should empty after delivery. A message that remains queued with repeated deferrals has not been delivered yet; read the exact SMTP response before changing settings.

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.

Correlate the queue ID across the journal, /var/log/mail.log, and Mailgun’s event or message records. A local “queued” response means only that Postfix accepted responsibility. It does not prove Mailgun accepted the message or that the recipient mailbox delivered it. Capture the timestamp, destination, response code, and queue ID when escalating an issue.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure modes

Authentication failed

Verify that the credential is the SMTP username and password for the correct Mailgun sending domain, not the control-panel password. Then compare the relay key character-for-character in both files. For port 587, both must use [smtp.mailgun.org]:587. After correcting the source file, rerun postmap /etc/postfix/sasl_passwd and restart or reload Postfix.

TLS or certificate errors

Check outbound connectivity to the selected port, the Ubuntu CA bundle, the server clock, and the hostname in relayhost. If you set smtp_tls_security_level = encrypt, any failure to negotiate TLS will defer delivery by design. Temporarily evaluating the endpoint with the documented may policy can help distinguish a strict-policy failure, but do not leave a security exception in place without deciding whether plaintext fallback is acceptable.

Messages stay queued or are repeatedly deferred

Read the SMTP response in /var/log/mail.log and the system journal. Check DNS resolution, outbound firewall rules, the selected port, and Mailgun account or sending limits. A blocked port 25 is a common reachability issue; try the supported submission port 587 or, where appropriate, 2525. Do not infer success from local queue acceptance alone.

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

The local application cannot submit

Confirm that Postfix is active, that the application is connecting to the local SMTP service, and that its source address is covered by the intended mynetworks policy or that it authenticates. Keep reject_unauth_destination enabled while making this adjustment. Broadening trusted networks is not a safe substitute for diagnosing the application’s actual connection address.

A configuration change appears to have no effect

Run postfix check, inspect effective values with postconf, regenerate the password database, and restart Postfix. Editing sasl_passwd without running postmap leaves the database unchanged, so Postfix continues using the old credential.

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.

Port connection times out

Test DNS resolution and the outbound firewall separately from authentication. A timeout usually indicates filtering or routing, not a bad password. If port 25 is blocked or throttled, use 587; if that is filtered, Mailgun documents 2525 as another STARTTLS-capable option. Keep the relay and password-map port numbers synchronized whenever you switch.

Operate the relay safely after it works

  • Rotate the Mailgun SMTP password when required, update the root-only source file, regenerate the map, and restart Postfix.
  • Review file ownership and mode after package upgrades, configuration-management runs, and restores from backup.
  • Monitor the queue and mail logs for authentication failures, repeated deferrals, and unexpected volume.
  • Keep outbound firewall rules limited to the submission ports you actually use.
  • Retain the destination rejection rule and periodically verify that an unauthorized client cannot relay to an arbitrary domain.
  • Document the selected port, TLS policy, credential owner, and the local applications permitted to submit mail.

Plan credential rotation and incident response before the first production message. If a password is exposed, revoke or replace it in Mailgun immediately, update the protected map, regenerate the database, and review logs for unexpected submissions. Restrict administrative access to the Ubuntu host because anyone who can read the map can impersonate the sending domain through your relay.

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

Configuration checklist

Check Expected result
Relay endpoint [smtp.mailgun.org]:587, or a deliberately selected supported port
Credentials SMTP credentials for the Mailgun sending domain, not the control-panel password
SASL smtp_sasl_auth_enable = yes and smtp_sasl_security_options = noanonymous
Password map hash:/etc/postfix/sasl_passwd, regenerated with postmap, source mode 600
TLS STARTTLS offered on 587, CA validation available, and policy chosen intentionally
Relay protection permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
Validation postfix check succeeds and the service restarts cleanly
Proof of delivery A real test message is accepted, the queue clears, and logs show authenticated remote delivery

Frequently Asked Questions

Which Mailgun SMTP port should I use with Postfix?

Start with port 587 and the relay key [smtp.mailgun.org]:587. It uses STARTTLS and is generally more reachable than port 25. Port 2525 is another STARTTLS option when common SMTP ports are filtered. Port 465 uses implicit TLS and requires a different client mode, so it is not interchangeable with the sample configuration.

Can I use my Mailgun dashboard password?

No. Mailgun issues SMTP credentials for each sending domain. Use that domain’s SMTP username and password in /etc/postfix/sasl_passwd; the control-panel password is not the relay credential.

Why does Postfix say no SASL password was found?

The password-map key normally does not match relayhost exactly. Include the brackets and port, such as [smtp.mailgun.org]:587, rerun postmap /etc/postfix/sasl_passwd, and reload or restart Postfix.

Should TLS be set to may or encrypt?

may permits an upgrade when STARTTLS is offered and can fall back if negotiation fails. encrypt requires TLS and defers delivery whenever encryption cannot be established. Choose encrypt only after confirming reachability, CA validation, hostname matching, and correct server time.

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

How do I know the server is not an open relay?

Keep reject_unauth_destination after permit_sasl_authenticated,permit_mynetworks, restrict mynetworks to controlled addresses, and test from an unauthorized client. The unauthorized attempt should be rejected rather than queued for an arbitrary destination.

Does a successful sendmail command prove delivery?

It proves that Postfix accepted the local submission. Confirm remote acceptance by finding SASL authentication and a successful Mailgun response in the logs, seeing the queue clear, and checking the recipient mailbox or Mailgun event records.

What should I do after changing the SMTP password?

Edit the root-only source map, run postmap /etc/postfix/sasl_passwd, then reload or restart Postfix. Verify ownership and mode again and send a new test message; editing only the plaintext file leaves the old database entry active.

Why are messages repeatedly deferred?

Read the exact SMTP response in /var/log/mail.log and the system journal. Check DNS, outbound firewall rules, the selected port, TLS certificate validation, Mailgun account limits, and the queue ID. A local queue acceptance is not proof that Mailgun accepted the message.

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

The Bottom Line

Use Postfix as a restricted smarthost: configure [smtp.mailgun.org]:587, authenticate with the sending domain’s SMTP credentials, protect and regenerate the SASL map, and keep reject_unauth_destination enabled. Choose TLS policy deliberately, then prove the path with a real message, an empty queue, and authenticated delivery entries in the logs.

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
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.