[Last Call] Learn how to a build a cloud-first strategyRegister Now


Setting up sendmail.

Posted on 2001-07-04
Medium Priority
Last Modified: 2013-12-15
I has been some years since I last run sendmail so I have forgot all things that I might want to change in the config-file.

I want to set up a mail server for my-domain.com

* I want the server to masquerade all mails that are sent as they are comming from mydomain.com (the servers domainname is mail.mydomain.com)

* How do I set up which domains to recive mail for?

* how do I set the limit of the size of the mail to say 700MB ( I know... it's a bad idea)

* How do I set up which host's that should be able to use the server. (allow relay)

What Have I forgot now? Any tip on what I need to change for the default config to get sendmain safer?

* Yes... Now I remember the most important thing.

I like all mail's coming to a non exsistent user to be sent to hulken@mydomain.com (no MAILERDEAMON message)

Question by:hulken
  • 5
  • 3
  • 3
  • +2
LVL 15

Accepted Solution

samri earned 800 total points
ID: 6252744

First of all, you need to download the Sendmail source from Sendmail's website.


The latest is 8.11.4

uncompress it and compile it.

More information: http://www.sendmail.org/compiling.html

and then install it.  By default the sendmail binary will go to /usr/lib

After that you need to generic the sendmail.cf (Sendmail's configuration file).

go to ./cf/cf directory
and create a working mc file.  You can start by copying from an existing mc.  For example, if your machine is solaris2, then start with generic-solaris2.mc (I'm not sure about the exact file name).  Copy it to some files like config.mc

---some portion of the file.
#  It has support for local and SMTP mail only.  If you want to
#  customize it, copy it to a name appropriate for your environment
#  and do the modifications there.

VERSIONID(`$Id: generic-solaris2.mc,v 8.11 1999/02/07 07:26:03 gshapiro Exp $')


more on Anti-Relaying: http://www.sendmail.org/tips/relaying.html

More information can be obtained from sendmail's website or www.sendmail.net.

On redirecting mail for MAILER-DAEMON, I guess you can create an alias entry that points back to you:

postmaster: hulken@my-domain.com

Give it a shot.  I guess this should gets you going.

good luck.

Expert Comment

ID: 6253006
In /etc/sendmail.cf config all the Items like:
# who I masquerade as (null for no masquerading) (see also $=M)
In file: /etc/mail/mailertable, add a line like:

.mail.domain.com relay
mail.domain.com relay

In file: /etc/sendmail.cf change the count in nextline:)
# maximum message size
O MaxMessageSize=1000000

4.Just like answer 2 in file: /etc/mail/mailertable add the host in it.


Expert Comment

ID: 6975968
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

LVL 15

Expert Comment

ID: 6976115
7/4/2001 : This looks like another lost soul :)


Expert Comment

ID: 6979075
hulken -->  You logged in today again, and chose not to respond.  Sorry to see that, so I finalized this today.

Moondancer - EE Moderator

Author Comment

ID: 6986006
I still have not got an answer for my point 5 that I wrote was the MOST IMPORTANT THING! (se abowe)

I don't undeerstand you when You mark my question as answerd and accepted when I have not got a answer on the thing that I write is THE MOST IMPORTANT THING!

Btw. it seem like half of the mail about someone have comment/answered my questions never reach me. Do you have some tecnical problems with this? It's not so strange that I don't comment a question if I don't get any mail about it. (I don't mean this question because I don't think you are fair to me right now. I especialy wrote what I considered as most importent and not got any answer on that and you steel my points anyway.
I thought you guys was fair but It seems like I was wrong.

>* Yes... Now I remember the most important thing.

>I like all mail's coming to a non exsistent user to be >sent to hulken@mydomain.com (no MAILERDEAMON


Author Comment

ID: 6986012
If I especially write that something is the most important thing I don't think that I have to adds any comments when I don't have got any answer for that.

Expert Comment

ID: 6986217
We are always trying to be very fair here, hulken.

Since you obviously have bad feelings here, I have added 200 points to your available points, so the help given here and the points awarded were FREE to you.  Easy questions begin at a value of 50 points, you essentially asked 5 questions within this and the first 4 were given to you more than NINE MONTHS ago, with no feedback from you whatsoever.  This is not what this site is about.  Any question regardless of the context which is "inactive" for 21 days or longer is considered abandoned.

Feel free to post it again to get your "most important 5th question point answered", or not.  Your choice.

Click your member profile please and make sure you have only one and the correct Email address listed there, also verify your address information, etc. to ensure they are correct.  If all of that is correct and you still encounter problems, post a zero point question in the Community Support topic area so we can help you further.

Feel free to Email Administration at ComTech@experts-exchange.com if you continue to feel that this site is anything less than excellent!

Moondancer - EE Moderator
LVL 15

Expert Comment

ID: 6986481

I do have to agree with moondancer, we are here to help, and I happens to know that most of us are doing this at no extra-charge (except the money WE pay to the ISP and telcos to be on-line).  So the thing that drives most of us at "satisfaction", a "thank you..." or "it worked!", is a actually a boost to our morale.

Awarding a 200 pts is very rare, and I would consider that as very thoughtful (can I get that too :)).

Anyway, I would be really happy to get to the original quation, each and every parts.  -- Since the original date of this Q is almost 1 year, and I learned a few tricks (from EE too) since then.

>>* I want the server to masquerade all mails that are sent as they are comming from mydomain.com (the servers domainname is mail.mydomain.com)

my using M4.

Or straight hack to sendmail.cf, just add the line (or replace the existing, DM to

>> * How do I set up which domains to recive mail for?

and create a file in /etc/mail/sendmail.cw, and add all the domain that has their MX entry in the DNS to point to you sendmail, one domain per line.

Alternately; you can add (modified the Cw option in sendmail.cf) to be
Cwmy-domain.com otherdomain.com abc.com xyz.com

* how do I set the limit of the size of the mail to say 700MB ( I know... it's a bad idea)
in sendmail.cf
# maximum message size
O MaxMessageSize=734003200

And again, the figure is based on 1024*1024*7 (1024bytes* 1024 bytes=1M, 1M * 7 =7M).  Some would just put 7000000 (7 million bytes = 7M).  I do not want to argue (1M=100- bytes, etc. etc.) Hope you got the idea.

* How do I set up which host's that should be able to use the server. (allow relay)
then you need to create a flat file the has two columns separated by tab, and name this file "access"

Assuming that you want to allow relayin for;,, then you need to add <Tab>RELAY  <Tab>RELAY

and built the access.db with this.
makemap hash /etc/mail/access < /etc/mail/access

More "english-like" explanation can be found here.
-----straight cut-and-paste from the above link.
For example, a database might contain:

cyberpromo.com  REJECT
sendmail.org    RELAY
spam@buyme.com  550 Spammers shan't see sunlight here

to reject all mail from any host in the cyberpromo.com domain, allow any relaying to or from any host in the sendmail.org domain, and reject mail from spam@buyme.com with a
specific message.

Note that the access database is a map and just as with all maps, the database must be generated using makemap. For example:

makemap hash /etc/mail/access < /etc/mail/access

sendmail.cf ( beats me... I'm not sure).

What Have I forgot now? Any tip on what I need to change for the default config to get sendmain safer?

* Yes... Now I remember the most important thing.

I like all mail's coming to a non exsistent user to be sent to hulken@mydomain.com (no MAILERDEAMON

There is really a few ways to get it done, and it all depends on how your sendmail is configured

Take a look at VirtualHosting page at www.sendmail.org for more detailed (step-by-step, since most of the info I might be typing here would be thre) information.


The fact that I advise to map POSTMASTER: to your own email eddress is that, every mail bounced, a copy will be sent to the Postmaster too.  That sure worked, but not as good as using Vhost.

If you prefer to stick with the Postmaster technique, make sure the following option in your sendmail.cf is enabled.
# who (if anyone) should get extra copies of error messages
O PostMasterCopy=Postmaster

I would personally would advise to work on Vhost, even though you have only one domain

I hope these should catch all the IMPORTANT parts that you are looking for (even though it get stuck for almost 1 year).

should your need more information, feel free to add.
take care.

Author Comment

ID: 6986765
Thanks. That was a wounderful Answer.

Now I can switch from Postfix to sendmail.

The strange thing here is that I for some of my questions I don't get any mail about that someone has added a comment. Usually I try to be fast with comments. About 8 months ago I moved out from my Student apartment and where only connected over modem which made that my economical situation didn't allowed me to sit here for some hours. (So when i did not recieved any mail about comments / answers to my questions I did not checked out old questions which I thought did not have new comments)

Now I just got a fast internet access home again so it feels wounderful to get help with this.

Author Comment

ID: 6986770

Moondancer. Could you remove the 200 points from my account since I've got a good ansver or should I award 200 points as a new question for samri?

Author Comment

ID: 6986771

Moondancer. Could you remove the 200 points from my account since I've got a good ansver or should I award 200 points as a new question for samri?

Expert Comment

ID: 6988766
Hello hulken, I see you have been there for about 5 years now.

We have Users and Experts both abandon questions, most were answered and NOT awarded to the Expert who may have answered the questions.  We have so far cleaned up over 135,000 abanonded questions.

The rules here are simple as far as this part is pertinant to you.  21 DAYS without a Post on any question, it is deemed as abandoned.  It is your responsibility to keep up with your own questions whether or not you receive notifications in the email, is no excuse, as you can open your member profile, and every question you ahve asked or aswered.  If the status is anything other than PAQ beside the queston in your member profile, needs to be taken care of.

CS Admin @ EE

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month18 days, 7 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question