{"id":153,"date":"2012-05-02T19:21:23","date_gmt":"2012-05-02T19:21:23","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=153"},"modified":"2022-12-19T08:06:26","modified_gmt":"2022-12-19T14:06:26","slug":"virtual-users-and-domains-with-sendmail","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/","title":{"rendered":"Virtual Users And Domains With Sendmail"},"content":{"rendered":"
<\/div>

\"sendmail\"The objective of this guide is to enable Sendmail’s virtual user table, which allows us to configure user-specific and domain-wide email aliases for multiple domains. These instructions assume you are using a CentOS virtual server<\/a>.<\/p>\n

Sendmail uses a highly complex rule system for it’s configuration so instead of editing sendmail.cf directly, we will edit the sendmail.mc file.<\/p>\n

Accepting mail for virtual domains\/users<\/h2>\n

1.Create a new system user and set the password for that user.<\/p>\n

useradd exampleuser\r\npasswd exampleuser<\/pre>\n

2. Add the user to the sendmail’s virtusertable file. Open the ‘\/etc\/mail\/virtusertable’ file and add the following:<\/p>\n

exampleuser@exampledomain.tld    exampleuser<\/pre>\n

Each line in the \/etc\/mail\/virtusertable file should be of the following format:<\/p>\n

username@domainname    systemuser<\/pre>\n

3. Add each new domain name to the \/etc\/mail\/local-host-names file<\/p>\n

exampledomain.tld<\/pre>\n

4. Generate a new sendmail.cf file by using the following commands:<\/p>\n

cd \/etc\/mail\r\nmake all\r\n\/etc\/init.d\/sendmail restart<\/pre>\n

Rewriting outgoing email addresses<\/h2>\n

1. Add the following lines to the \/etc\/mail\/sendmail.mc file:<\/p>\n

FEATURE(masquerade_envelope)\r\nFEATURE(genericstable, `hash -o \/etc\/mail\/genericstable')\r\nGENERICS_DOMAIN_FILE(`\/etc\/mail\/sendmail.gdf')<\/pre>\n

2. Create \/etc\/mail\/genericstable file containing local users mapped to desired addresses:<\/p>\n

exampleuser    exampleuser@exampledomain.tld\r\nexampleuser2    exampleuser2@exampledomain.tld<\/pre>\n

3. Create \/etc\/mail\/sendmail.gdf file containing the fully qualified name of the local mail server.<\/p>\n

host.exampledomain.tld<\/pre>\n

4. Finally, generate a new sendmail.cf file:<\/p>\n

cd \/etc\/mail\r\nmake all\r\n\/etc\/init.d\/sendmail restart<\/pre>\n

PS.<\/strong><\/span> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

The objective of this guide is to enable Sendmail’s virtual user table, which allows us to configure user-specific and domain-wide … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":1132,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1706,13],"tags":[15,1152,14,16],"yoast_head":"\nVirtual Users And Domains With Sendmail - RoseHosting<\/title>\n<meta name=\"description\" content=\"Virtual Users And Domains With Sendmail - RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Virtual Users And Domains With Sendmail - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"Virtual Users And Domains With Sendmail - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-02T19:21:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-19T14:06:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Virtual Users And Domains With Sendmail\",\"datePublished\":\"2012-05-02T19:21:23+00:00\",\"dateModified\":\"2022-12-19T14:06:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\"},\"wordCount\":217,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg\",\"keywords\":[\"mail\",\"rosehosting\",\"sendmail\",\"virtual domains\"],\"articleSection\":[\"CentOS\",\"Email Servers\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\",\"name\":\"Virtual Users And Domains With Sendmail - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg\",\"datePublished\":\"2012-05-02T19:21:23+00:00\",\"dateModified\":\"2022-12-19T14:06:26+00:00\",\"description\":\"Virtual Users And Domains With Sendmail - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg\",\"width\":\"200\",\"height\":\"200\",\"caption\":\"sendmail\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Virtual Users And Domains With Sendmail\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Virtual Users And Domains With Sendmail - RoseHosting","description":"Virtual Users And Domains With Sendmail - RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/","og_locale":"en_US","og_type":"article","og_title":"Virtual Users And Domains With Sendmail - RoseHosting","og_description":"Virtual Users And Domains With Sendmail - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2012-05-02T19:21:23+00:00","article_modified_time":"2022-12-19T14:06:26+00:00","og_image":[{"width":"200","height":"200","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Virtual Users And Domains With Sendmail","datePublished":"2012-05-02T19:21:23+00:00","dateModified":"2022-12-19T14:06:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/"},"wordCount":217,"commentCount":1,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg","keywords":["mail","rosehosting","sendmail","virtual domains"],"articleSection":["CentOS","Email Servers","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/","url":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/","name":"Virtual Users And Domains With Sendmail - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg","datePublished":"2012-05-02T19:21:23+00:00","dateModified":"2022-12-19T14:06:26+00:00","description":"Virtual Users And Domains With Sendmail - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2012\/05\/sendmail_0_129266.jpg","width":"200","height":"200","caption":"sendmail"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/virtual-users-and-domains-with-sendmail\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Virtual Users And Domains With Sendmail"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/153"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":3,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":44420,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/153\/revisions\/44420"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/1132"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}