{"id":5862,"date":"2020-10-06T13:12:57","date_gmt":"2020-10-06T07:42:57","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=5862"},"modified":"2026-11-18T09:10:07","modified_gmt":"2026-11-18T03:40:07","slug":"sendmail-configuration-smtp-relay-with-port-587","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/sendmail-configuration-smtp-relay-with-port-587\/","title":{"rendered":"Sendmail Configuration \u2013 SMTP Relay with Port 587"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sendmail SMTP Relay Configuration<\/strong> allows a server to send outgoing emails through an external SMTP relay using port 587. Sendmail uses SMTP authentication to connect to the relay server and send emails.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will explain how to install Sendmail, configure SASL authentication, update the Sendmail configuration files, and test email delivery using SMTP relay with port 587.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Configure Sendmail SMTP Relay with Port 587<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install Sendmail<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, install Sendmail and the Sendmail configuration package using the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apt-get install sendmail sendmail-cf<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Check and Install SASL Authentication<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check whether the <code>saslauthd<\/code> service is available on the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If it is not installed, install it using the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apt-get install sasl2-bin<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Enable the SASL Authentication Service<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the SASL authentication configuration file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vim \/etc\/default\/saslauthd<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find the <code>start<\/code> parameter and change its value to:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">start=yes<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the value will be set to <code>no<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Configure SMTP Authentication Information<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the authentication information file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vim \/etc\/mail\/authinfo<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following line, replacing the sample values with your SMTP relay provider&#8217;s details:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">AuthInfo:your-relay-domain.com \"U:your-username\" \"P:your-password\" \"M:PLAIN\"<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Configure the Sendmail SMTP Relay<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the Sendmail configuration file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi \/etc\/mail\/sendmail.mc<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Scroll down to the end of the file and add the following SMTP relay configuration lines:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dnl # SMTP Relay setup\ndefine(`RELAY_MAILER_ARGS', `TCP $h 587')dnl\ndefine(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl\ndefine(`SMART_HOST', `your-smtp-relay-host')dnl\ndefine(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl\nFEATURE(`authinfo',`hash \/etc\/mail\/authinfo')dnl<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the SMTP relay hostname with your actual SMTP provider&#8217;s hostname.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Update Sendmail Configuration and Authentication Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the Sendmail configuration directory:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/etc\/mail<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update the <code>sendmail.cf<\/code> and <code>authinfo.db<\/code> files using the following commands:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generate the Sendmail configuration file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">m4 sendmail.mc > sendmail.cf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Generate the authentication database:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">makemap hash authinfo &lt; authinfo<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Restart the Sendmail Service<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the Sendmail service to apply the configuration changes:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/etc\/init.d\/sendmail restart<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 8: Send a Test Email<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following command to send a test email:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">echo \"mail\" | mail -s \"Hello\" recipient@example.com<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>recipient@example.com<\/code> with the email address where you want to receive the test message.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 9: Check Email Delivery<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Wait for some time and check the recipient&#8217;s inbox to verify whether the test email has been delivered successfully.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring Sendmail with an SMTP relay on port 587 allows servers to send outbound emails through an external mail server. By installing Sendmail, configuring SASL authentication, updating the relay settings, and sending a test email, you can complete the SMTP relay configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Documentation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.sendmail.org\/~ca\/email\/auth.html\" target=\"_blank\" rel=\"noopener\">Sendmail \u2013 SMTP AUTH Configuration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.oracle.com\/en\/operating-systems\/oracle-linux\/6\/admin\/configure-sendmail.html\" target=\"_blank\" rel=\"noopener\">Oracle Linux \u2013 Configuring a Sendmail Client<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.oracle.com\/en\/operating-systems\/oracle-linux\/6\/admin\/about-sendmail-config.html\" target=\"_blank\" rel=\"noopener\">Oracle Linux \u2013 Sendmail Configuration Files<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How Pheonix Solutions Can Help<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for reliable email server configuration and DevOps solutions?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/devops-cloud\/\">Pheonix Solutions<\/a> provides DevOps, cloud infrastructure, server administration, and email configuration services to help businesses maintain reliable IT environments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our experts can help you configure SMTP relays, manage Sendmail services, troubleshoot email delivery issues, and maintain server infrastructure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Contact our experts<\/a> to discuss your requirements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Sendmail SMTP Relay Configuration allows a server to send outgoing emails through an external SMTP relay using port 587. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13609,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[778,777,776],"class_list":["post-5862","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-aws","tag-external-server","tag-port-587","tag-sendmail-configuration","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1wy","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/Sendmail-SMTP-Relay-Port-587-Guide.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5862"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5862\/revisions"}],"predecessor-version":[{"id":13611,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5862\/revisions\/13611"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/13609"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}