October DealsAmazon USOctober deal check: compare before you payAmazon 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Send Mail From Sendmail Through a Gmail SMTP Server

A practical Sendmail guide for Gmail SMTP: choose port 587 or 465, create an app password or OAuth flow, configure SMART_HOST and authinfo, establish CA trust, test safely, and troubleshoot authentication, TLS, relay, timeout, and quota failures.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure Sendmail as a smart-host client for smtp.gmail.com. Use port 587 with STARTTLS in most installations, or port 465 when your Sendmail build supports implicit TLS. Gmail requires SMTP authentication: use the complete Gmail or Google Workspace address with a dedicated app password after enabling 2-Step Verification, or use OAuth 2.0 when your Sendmail integration supports the required SASL mechanism.

For organization-wide printers, servers, and applications, Google recommends its SMTP relay service rather than routing every device through one mailbox. The direct Gmail service is documented at Google Workspace Admin Help and in Gmail protocol documentation.

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.

What you need before changing Sendmail

This procedure assumes that Sendmail is already installed, can deliver local mail, and is built with SMTP AUTH and TLS support. You also need administrative access to its configuration and mail-log files. The exact paths and service commands differ between Linux and Unix distributions, so use your operating system’s Sendmail packaging conventions rather than copying a service command from another platform.

  • A Gmail or Google Workspace mailbox that is permitted to send through Gmail SMTP.
  • Outbound DNS resolution and TCP access from the Sendmail host to the selected SMTP port.
  • A CA certificate bundle on the host so Sendmail can verify Google’s certificate during STARTTLS.
  • Permission to edit the platform’s Sendmail .mc source and generate the corresponding sendmail.cf.
  • A protected location for the SMTP authentication map and its generated database.

Do not put a normal Google account password in a world-readable file or in source control. Credentials in an authentication map are operational secrets and should be readable only by the account that runs Sendmail and the administrators who maintain it.

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

Choose the Gmail transport and relay scope

Google maps its direct SMTP service to two common encrypted transports. Port 587 starts as ordinary SMTP, upgrades the connection with STARTTLS, verifies the peer certificate, and then authenticates. Port 465 negotiates TLS before any SMTP commands and is therefore an implicit-TLS connection. The current port guidance is documented by Google and Gmail’s protocol documentation.

Use case Hostname Port Encryption sequence Authentication
Single mailbox or small Sendmail host smtp.gmail.com 587 SMTP connection, STARTTLS, certificate verification, then SMTP AUTH Full address plus app password, or supported OAuth 2.0
Single mailbox or small Sendmail host with implicit TLS smtp.gmail.com 465 TLS is negotiated before SMTP commands Full address plus app password, or supported OAuth 2.0
Organization devices and applications smtp-relay.gmail.com 25, 465, or 587 Depends on the selected port and the relay policy Configured by the Workspace relay service; commonly scoped by organization policy or source IP rather than one mailbox password

Google explicitly recommends the SMTP relay service for devices and applications. Choose direct Gmail SMTP when Sendmail represents one mailbox or a small, clearly owned sending identity. Choose the Workspace relay when many devices or applications must send under an organization-managed policy, when rotating one mailbox credential would be impractical, or when you need centralized relay controls.

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

Prepare the Google account

Use an app password for a supported Sendmail deployment

  1. Sign in to the Google account that Sendmail will use.
  2. Enable 2-Step Verification if the account does not already require it.
  3. Create an app password dedicated to this Sendmail host. Label it with the host or service name so it can be revoked without disturbing unrelated applications.
  4. Record the generated app password in your secret-management process. Treat it as a password, not as configuration text that can be shared in tickets or committed to a repository.
  5. Use the complete mailbox address as the SMTP login. An address at a custom Google Workspace domain is not interchangeable with a shortened local username.

Google documents app-password requirements and Gmail protocol authentication in its Workspace SMTP guidance and protocol documentation. If the account’s policies do not permit app passwords, do not substitute the normal account password; use the approved OAuth 2.0 flow or an organizational relay.

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

Use OAuth 2.0 when the integration supports it

Gmail protocols support OAuth 2.0. Sendmail itself must have a compatible SASL implementation and a way to obtain, refresh, and securely store OAuth tokens; availability depends on the installed Sendmail and SASL components. Confirm the exact mechanism exposed by your build, such as an XOAUTH2 or OAUTHBEARER integration, before selecting this route. OAuth is not a drop-in replacement for an app-password string: it requires registering the client, obtaining consent and tokens, and arranging token refresh without placing a long-lived password in the authinfo map.

Point Sendmail at Gmail with SMART_HOST

Sendmail’s SMART_HOST setting routes outbound mail to a relay instead of having the local daemon deliver directly to each recipient domain. Edit the platform’s .mc source and add the Gmail hostname:

define(`SMART_HOST', `smtp.gmail.com')dnl

The exact location of the .mc file and the command used to generate sendmail.cf vary by operating system. Keep the change in the source .mc file; editing the generated .cf directly will be overwritten the next time configuration is rebuilt. If you choose the organization relay, substitute smtp-relay.gmail.com and apply the relay service’s policy requirements instead of a mailbox-specific setup.

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

Enable SMTP AUTH with authinfo

Sendmail’s authinfo feature supplies SMTP AUTH credentials to the relay. Enable it in the supported form for your installed version, and generate a protected map database. A common m4 declaration is:

FEATURE(`authinfo', `hash -o /etc/mail/authinfo.db')dnl

The map syntax, source-file location, ownership, and permissions are distribution-specific. Read the Sendmail cf documentation shipped with your installation before creating the entry. The important matching rule is exact: the authinfo host key must be smtp.gmail.com when SMART_HOST is smtp.gmail.com. A key for an alias, a short hostname, or a different relay name will not be selected for the Gmail connection.

Store the complete Gmail address in the username field and the generated app password in the password field, or configure the OAuth mechanism supported by your deployment. Sendmail warns that plaintext mechanisms such as PLAIN and LOGIN should not be used unless a strong encryption layer such as STARTTLS or an external SSL tunnel is active. Port 587 therefore requires TLS negotiation to succeed before those mechanisms are allowed.

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
  • Restrict the authinfo source and database to the Sendmail service account and administrators.
  • Keep the source file out of public backups, paste services, and source repositories.
  • After rotating a credential, rebuild the map and reload Sendmail; an old generated database can continue to return the revoked secret.
  • Check that the relay hostname in the map and the value of SMART_HOST are identical, including spelling.

Configure certificate trust and TLS

STARTTLS is not only an encryption switch; Sendmail must also authenticate the server certificate. Install the CA bundle maintained by the host operating system and point Sendmail’s TLS configuration to it with the appropriate confCACERT file and/or confCACERT_PATH hashed directory. Sendmail’s STARTTLS support requires these trust settings to verify the peer certificate.

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

Use the CA file or directory supplied by your operating system rather than downloading an arbitrary certificate into the application directory. Verify that the Sendmail process can read the configured path, that a directory specified by confCACERT_PATH has the required hash links, and that the bundle has not expired or been replaced with an empty file. A missing or unreadable CA path commonly appears as a TLS or certificate error even though TCP connectivity is working.

For port 465, ensure the installed Sendmail/SASL stack actually supports implicit TLS. Some builds expose STARTTLS settings but do not provide a client mode for TLS-before-SMTP. If implicit TLS is unavailable, use port 587 with STARTTLS or deploy the external TLS method supported by your platform rather than sending unencrypted commands.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Build, reload, and perform a controlled test

  1. Save the .mc source, the authinfo source, and the TLS CA settings with restrictive permissions.
  2. Regenerate sendmail.cf using the operating system’s supported m4/build process. Do not assume that a command from another distribution uses the same directory or wrapper.
  3. Confirm that the generated configuration contains the intended smart host and authinfo feature, without printing the secret into a shared terminal transcript.
  4. Protect the generated configuration and authinfo database, then reload or restart the Sendmail service using the host’s service manager.
  5. Send one test message to an address you control. Use a unique subject and timestamp so it can be correlated with the mail log.
  6. Inspect the mail log while the test runs. Look for DNS resolution, TCP connection, STARTTLS negotiation, certificate verification, SMTP AUTH response, Gmail policy response, and final queue status.
  7. Repeat with a recipient at a different domain only after the first authenticated submission succeeds. This separates Gmail submission problems from recipient-domain delivery or spam filtering.

Service names, reload commands, and log locations are not uniform across Linux and Unix. If the test message remains queued, inspect the queue and the first SMTP error rather than repeatedly retrying; repeated retries can obscure the original failure and may compound throttling.

Troubleshooting Sendmail-to-Gmail failures

Symptom Likely cause What to check or change
Authentication rejected A normal account password was used, the app password is invalid or revoked, 2-Step Verification or an app-password policy is not satisfied, or the OAuth SASL flow is mismatched. Create a new app password after confirming the account policy, use the full account address, or validate the OAuth token and mechanism. Do not keep retrying a known-invalid password.
STARTTLS or certificate error Missing CA bundle, incorrect confCACERT/confCACERT_PATH, unreadable trust directory, expired bundle, or a Sendmail build without client TLS support. Verify the configured path and permissions, refresh the operating-system CA bundle, confirm Sendmail TLS support, and inspect the log for the certificate name or chain that failed.
Relay denied or authentication appears unused The authinfo key does not exactly match smtp.gmail.com, the map database was not rebuilt, or SMART_HOST points to a different host than expected. Compare the generated smart-host value and map key character-for-character, rebuild the map, reload Sendmail, and check that the intended feature is present in the generated configuration.
Connection timeout or connection refused An egress firewall, security group, proxy, or ISP policy blocks the selected SMTP port, or DNS cannot resolve the relay. Test DNS resolution and outbound TCP access to port 587 or 465 from the Sendmail host. If one permitted port is blocked, use the other supported encrypted transport after confirming the Sendmail TLS mode.
Messages are throttled or rejected after successful login Gmail sending limits, spam or policy enforcement, or an unsuitable mailbox-as-relay design. Review the documented Gmail SMTP limit of 2,000 messages per day, inspect the exact SMTP response, reduce or queue traffic, and move organization-scale device/application traffic to the Workspace SMTP relay.
Port 465 connects but SMTP commands fail The client opened a plain SMTP session to a port expecting implicit TLS, or the local Sendmail build cannot act as an implicit-TLS client. Use the platform’s documented implicit-TLS configuration, or switch to port 587 and require STARTTLS.

Direct Gmail SMTP versus Workspace SMTP relay

Both services can submit mail through Google, but they solve different operational problems. Direct Gmail SMTP associates every submission with one mailbox credential. The Workspace relay is intended for devices and applications and is administered as an organizational service.

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.
Decision factor smtp.gmail.com smtp-relay.gmail.com
Primary scope One Gmail or Workspace mailbox used by Sendmail Organization-managed printers, servers, and applications
Credential model Full mailbox address plus app password, or supported OAuth 2.0 Workspace relay policy, commonly scoped by approved source IP or organizational settings
Documented ports 465 for SSL/implicit TLS and 587 for TLS/STARTTLS 25, 465, and 587
Operational ownership Mailbox owner or small service team rotates the credential Workspace administrators manage relay access and policy
Best fit A limited number of trusted Sendmail hosts representing a known sender Many devices or applications that should not share one mailbox password

Google’s guidance recommends SMTP relay for sending from devices or applications. A relay does not remove the need to define encryption, source restrictions, and logging; it changes where those controls are administered.

Security and maintenance checklist

  • Use port 587 with verified STARTTLS unless your tested Sendmail build specifically requires implicit TLS on port 465.
  • Never use a normal Google account password in Sendmail. Prefer a dedicated app password where policy permits, or a fully implemented OAuth 2.0 integration.
  • Keep the authinfo source and database out of world-readable locations and repositories.
  • Match the authinfo key to the exact smart-host hostname.
  • Maintain the operating system’s CA bundle and test certificate verification after CA or Sendmail upgrades.
  • Monitor mail logs for authentication failures, TLS errors, queue growth, Gmail policy responses, and quota-related responses.
  • Rotate app passwords when staff, hosts, or ownership changes, then rebuild the map and reload Sendmail.
  • For growing or multi-device workloads, plan a move to the Workspace SMTP relay before a mailbox limit or policy block interrupts delivery.

What a successful submission looks like

A correctly configured port-587 flow resolves smtp.gmail.com, opens a TCP connection, receives the server greeting, negotiates STARTTLS, validates Google’s certificate against the configured CA trust, authenticates with the complete address and approved credential, accepts the message for submission, and records a successful queue or delivery result in the Sendmail log. A port-465 flow performs the TLS handshake before the SMTP greeting and then follows the same authentication and submission stages.

If any stage fails, use the first corresponding log entry to choose the fix: DNS or TCP errors indicate network access, TLS errors indicate encryption or trust configuration, authentication errors indicate credentials or SASL, and policy or quota responses indicate that the chosen Gmail service is not appropriate for the traffic pattern.

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.

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

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.