View | Details | Raw Unified | Return to bug 38318
Collapse All | Expand All

(-)chapter.sgml (-65 / +55 lines)
Lines 397-403 Link Here
397
      the local host name.  Place any domains or hosts that
397
      the local host name.  Place any domains or hosts that
398
      <application>sendmail</application> is to be receiving mail for.
398
      <application>sendmail</application> is to be receiving mail for.
399
      For example, if this mail server was to accept mail for the
399
      For example, if this mail server was to accept mail for the
400
      domain example.com and the host
400
      domain <hostid role="domainname">example.com</hostid> and the host
401
      <hostid>mail.example.com</hostid>, its
401
      <hostid>mail.example.com</hostid>, its
402
      <filename>local-host-names</filename> might look something like
402
      <filename>local-host-names</filename> might look something like
403
      this:</para>
403
      this:</para>
Lines 406-412 Link Here
406
mail.example.com</programlisting>
406
mail.example.com</programlisting>
407
407
408
    <para>When this file is updated, &man.sendmail.8; needs to be
408
    <para>When this file is updated, &man.sendmail.8; needs to be
409
    restarted for it to read the changes.</para>
409
    restarted to read the changes.</para>
410
    
410
    
411
  </sect2>
411
  </sect2>
412
412
Lines 416-430 Link Here
416
    <para><application>sendmail</application>'s master configuration
416
    <para><application>sendmail</application>'s master configuration
417
      file, <filename>sendmail.cf</filename> controls the overall
417
      file, <filename>sendmail.cf</filename> controls the overall
418
      behavior of <application>sendmail</application>, including everything
418
      behavior of <application>sendmail</application>, including everything
419
      from rewriting e-mail addresses to printing reject messages for
419
      from rewriting e-mail addresses to printing rejection messages to
420
      remote mail servers.  Naturally, with such a diverse role, this
420
      remote mail servers.  Naturally, with such a diverse role, this
421
      configuration file is quite complex and its details are a bit
421
      configuration file is quite complex and its details are a bit
422
      out of the scope of this section.  Fortunately, this file rarely
422
      out of the scope of this section.  Fortunately, this file rarely
423
      needs to be changed for standard mail servers.</para>
423
      needs to be changed for standard mail servers.</para>
424
424
425
    <para>The master <application>sendmail</application> configuration
425
    <para>The master <application>sendmail</application> configuration
426
      file can be built from &man.m4.1; macros that define features
426
      file can be built from &man.m4.1; macros that define the features
427
      and behavior of sendmail.  Please see
427
      and behavior of <application>sendmail</application>.  Please see
428
      <filename>/usr/src/contrib/sendmail/cf/README</filename> for
428
      <filename>/usr/src/contrib/sendmail/cf/README</filename> for
429
      some of the details.</para>
429
      some of the details.</para>
430
430
Lines 436-446 Link Here
436
  <sect2>
436
  <sect2>
437
    <title><filename>/etc/mail/virtusertable</filename></title>
437
    <title><filename>/etc/mail/virtusertable</filename></title>
438
438
439
    <para>The <filename>virtualusertable</filename> maps mail for 
439
    <para>The <filename>virtualusertable</filename> maps mail addresses for 
440
      virtual domains and
440
      virtual domains and
441
      mailboxes to real mailboxes.  These mailboxes can be local,
441
      mailboxes to real mailboxes.  These mailboxes can be local,
442
      remote, an alias defined in
442
      remote, aliases defined in
443
      <filename>/etc/mail/aliases</filename> or a file.</para>
443
      <filename>/etc/mail/aliases</filename> or files.</para>
444
444
445
    <example>
445
    <example>
446
	<title>Example Virtual Domain Mail Map</title>
446
	<title>Example Virtual Domain Mail Map</title>
Lines 570-577 Link Here
570
	    <application>sendmail</application>-compatible system.  If
570
	    <application>sendmail</application>-compatible system.  If
571
	    applications continue to use
571
	    applications continue to use
572
	    <application>sendmail</application>'s binaries to try and send
572
	    <application>sendmail</application>'s binaries to try and send
573
	    e-mail after you have disabled it, the mail may transparently
573
	    e-mail after you have disabled it, the mail may silently
574
	    queue forever.</para>
574
	    wait forever.</para>
575
	</warning>
575
	</warning>
576
576
577
	<para>If you only want to disable
577
	<para>If you only want to disable
Lines 600-610 Link Here
600
	  <filename>/usr/local/etc/rc.d/</filename> that
600
	  <filename>/usr/local/etc/rc.d/</filename> that
601
	  ends in <filename>.sh</filename> and is executable by
601
	  ends in <filename>.sh</filename> and is executable by
602
	  <username>root</username>.  The script should also accept the
602
	  <username>root</username>.  The script should also accept the
603
	  parameters 'start' and 'stop'.  So that you could, for example, execute
603
	  parameters 'start' and 'stop'.  The system will execute it with these arguments at start and shutdown time, e.g.,
604
	  <filename>/usr/local/etc/rc.d/supermailer.sh start</filename>
604
	  <filename>/usr/local/etc/rc.d/supermailer.sh start</filename>
605
	  or <filename>/usr/local/etc/rc.d/supermailer.sh stop</filename>.
605
	  or <filename>/usr/local/etc/rc.d/supermailer.sh stop</filename>; you can also do this manually to start and stop your new MTA.</para>
606
	  The system will call your script using 'start' when the it
607
	  boots and using 'stop' when the it shuts down.</para>
608
606
609
      </sect3>
607
      </sect3>
610
608
Lines 613-625 Link Here
613
	  (including 4.6-RELEASE and later)</title>
611
	  (including 4.6-RELEASE and later)</title>
614
612
615
	<para>With later versions of FreeBSD, you can use the
613
	<para>With later versions of FreeBSD, you can use the
616
	  above method or you can also set</para>
614
	  above method or you can set</para>
617
615
618
	<programlisting>mta_start_script="filename"</programlisting>
616
	<programlisting>mta_start_script="filename"</programlisting>
619
617
620
	<para>in <filename>/etc/rc.conf</filename>, where
618
	<para>in <filename>/etc/rc.conf</filename>, where
621
	  <replaceable>filename</replaceable> is the name of some
619
	  <replaceable>filename</replaceable> is the name of some
622
	  script that you want executed on boot to start your
620
	  script that you want executed at boot to start your
623
	  MTA.</para>
621
	  MTA.</para>
624
      </sect3>
622
      </sect3>
625
623
Lines 630-640 Link Here
630
       the system's default mailer</title>
628
       the system's default mailer</title>
631
629
632
      <para><application>Sendmail</application> is so ubiquitous
630
      <para><application>Sendmail</application> is so ubiquitous
633
	as standard software on Unix systems, that some software
631
	as standard software on Unix systems that some software
634
	just presumes that it is already installed and configured.
632
	just assumes it is already installed and configured.
635
	For this reason, many alternative MTA's provide utilities
633
	For this reason, many alternative MTA's provide utilities
636
	that implement exactly the same command-line interface
634
	that implement the <application>sendmail</application> command-line interface exactly.</para>
637
	that <application>sendmail</application> provides.</para>
638
635
639
      <para>Therefore, if you are using an alternative mailer,
636
      <para>Therefore, if you are using an alternative mailer,
640
	you will need to make sure that software trying to execute
637
	you will need to make sure that software trying to execute
Lines 655-672 Link Here
655
hoststat	/usr/libexec/sendmail/sendmail
652
hoststat	/usr/libexec/sendmail/sendmail
656
purgestat	/usr/libexec/sendmail/sendmail</programlisting>
653
purgestat	/usr/libexec/sendmail/sendmail</programlisting>
657
654
658
      <para>This means that when any of these common commands
655
      <para>This means, for example, that when <filename>sendmail</filename> is invoked, <filename>/usr/bin/mailwrapper</filename> is actually executed; mailwrapper checks <filename>mailer.conf</filename>, and based on what it finds there, executes <filename>/usr/libexec/sendmail/sendmail</filename>.  This system makes it easy to change what binaries
659
	are run, such as <filename>/usr/bin/sendmail</filename>
660
	the program that is actually sitting in that location
661
	checks <filename>mailer.conf</filename> and
662
	executes <filename>/usr/libexec/sendmail/sendmail</filename>
663
	instead.  This system makes it easy to change what binaries
664
	are actually executed when these default system utilities
656
	are actually executed when these default system utilities
665
	are run.</para>
657
	are run.</para>
666
658
667
      <para>Therefore if you wanted
659
      <para>Therefore if you wanted
668
	<filename>/usr/local/supermailer/bin/sendmail-compat</filename>
660
	<filename>/usr/local/supermailer/bin/sendmail-compat</filename>
669
	to be run instead of sendmail, you would change
661
	to be run instead of <application>sendmail</application>, you would change
670
	<filename>/etc/mail/mailer.conf</filename> to read:</para>
662
	<filename>/etc/mail/mailer.conf</filename> to read:</para>
671
663
672
<programlisting>sendmail	 /usr/local/supermailer/bin/sendmail-compat
664
<programlisting>sendmail	 /usr/local/supermailer/bin/sendmail-compat
Lines 681-692 Link Here
681
	<sect2>
673
	<sect2>
682
	  <title>Finishing</title>
674
	  <title>Finishing</title>
683
675
684
	<para>Once you have everything configured how you want it, you should
676
	<para>Once you have everything configured the way you want it, you should
685
	  either kill the <application>sendmail</application> processes that
677
	  either kill the <application>sendmail</application> processes that
686
	  you no longer need and start the processes belonging to your new
678
	  you no longer need and start the processes belonging to your new
687
	  software.  Or you should reboot your machine.  Rebooting will also
679
	  software, or simply reboot.  Rebooting will also
688
	  give you the opportunity to ensure that you have correctly
680
	  give you the opportunity to ensure that you have correctly
689
	  configured your machine to start your new MTA on boot.</para>
681
	  configured your system to start your new MTA automatically on boot.</para>
690
682
691
      </sect2>
683
      </sect2>
692
    </sect1>
684
    </sect1>
Lines 801-809 Link Here
801
          
793
          
802
	<para>Only one host should be specified as the final recipient
794
	<para>Only one host should be specified as the final recipient
803
	  (add <literal>Cw bigco.com</literal> in
795
	  (add <literal>Cw bigco.com</literal> in
804
	  <filename>/etc/mail/sendmail.cf</filename> on bigco.com).</para>
796
	  <filename>/etc/mail/sendmail.cf</filename> on <hostid role="domainname">bigco.com</hostid>).</para>
805
          
797
          
806
	<para>When the senders' <command>sendmail</command> is trying to
798
	<para>When the sender's <command>sendmail</command> is trying to
807
	  deliver the mail it will try to connect to you over the modem
799
	  deliver the mail it will try to connect to you over the modem
808
	  link.  It will most likely time out because you are not online.
800
	  link.  It will most likely time out because you are not online.
809
	  <command>sendmail</command> will automatically deliver it to the
801
	  <command>sendmail</command> will automatically deliver it to the
Lines 869-875 Link Here
869
861
870
	<answer>
862
	<answer>
871
	  <para>In default FreeBSD installations,
863
	  <para>In default FreeBSD installations,
872
 	    <application>Sendmail</application> is configured to only
864
 	    <application>sendmail</application> is configured to only
873
 	    send mail from the host it is running on.  For example, if
865
 	    send mail from the host it is running on.  For example, if
874
 	    a POP3 server is installed, then users will be able to
866
 	    a POP3 server is installed, then users will be able to
875
 	    check mail from school, work, or other remote locations
867
 	    check mail from school, work, or other remote locations
Lines 881-902 Link Here
881
 	    message.</para>
873
 	    message.</para>
882
874
883
	  <para>There are several ways to get around this.  The most
875
	  <para>There are several ways to get around this.  The most
884
 	    straight forward solution is to put your ISP's address in
876
 	    straightforward solution is to put your ISP's address in
885
 	    a relay-domains file at
877
 	    a relay-domains file at
886
 	    <filename>/etc/mail/relay-domains</filename>.  A quick way
878
 	    <filename>/etc/mail/relay-domains</filename>.  A quick way
887
 	    to do this would be:</para>
879
 	    to do this would be:</para>
888
880
889
	  <screen>&prompt.root; <userinput>echo "your.isp.example.com" &gt; /etc/mail/relay-domains</userinput></screen>
881
	  <screen>&prompt.root; <userinput>echo "your.isp.example.com" &gt; /etc/mail/relay-domains</userinput></screen>
890
882
891
	  <para>After creating this file you must restart
883
	  <para>After creating or editing this file you must restart
892
  	    <application>sendmail</application>.  This works great if
884
  	    <application>sendmail</application>.  This works great if
893
  	    you are a server admin and don't wish to send mail
885
  	    you are a server admin and don't wish to send mail
894
  	    locally, or would like to use a point and click
886
  	    locally, or would like to use a point and click
895
  	    client/system on another machine or even another ISP.  It
887
  	    client/system on another machine or even another ISP.  It
896
  	    is also very useful if you only have one or two email
888
  	    is also very useful if you only have one or two email
897
  	    accounts setup.  If there are a large number of addresses
889
  	    accounts set up.  If there are a large number of addresses
898
  	    to add, you can simply open this file in your favorite
890
  	    to add, you can simply open this file in your favorite
899
  	    text editor and then add the domains one per line:</para>
891
  	    text editor and then add the domains, one per line:</para>
900
892
901
	  <programlisting>your.isp.example.com
893
	  <programlisting>your.isp.example.com
902
other.isp.example.net
894
other.isp.example.net
Lines 904-911 Link Here
904
www.example.org</programlisting>
896
www.example.org</programlisting>
905
897
906
	  <para>Now any mail sent through your system, by any host in
898
	  <para>Now any mail sent through your system, by any host in
907
	    this list, providing the user has an account on your
899
	    this list (provided the user has an account on your
908
	    system, will succeed.  This is a very nice way to allow
900
	    system), will succeed.  This is a very nice way to allow
909
	    users to send mail from your system remotely without
901
	    users to send mail from your system remotely without
910
	    allowing people to send SPAM through your system.</para>
902
	    allowing people to send SPAM through your system.</para>
911
903
Lines 931-937 Link Here
931
        hosts as long as you have set up
923
        hosts as long as you have set up
932
	<filename>/etc/resolv.conf</filename> or are running your own
924
	<filename>/etc/resolv.conf</filename> or are running your own
933
	name server.  If you would like to have mail for your host
925
	name server.  If you would like to have mail for your host
934
	delivered to that specific host, there are two methods:</para>
926
	delivered to the MTA (e.g., <application>sendmail</application>) on your own FreeBSD host, there are two methods:</para>
935
927
936
      <itemizedlist>
928
      <itemizedlist>
937
        <listitem>
929
        <listitem>
Lines 950-965 Link Here
950
942
951
      <indexterm><primary>SMTP</primary></indexterm>
943
      <indexterm><primary>SMTP</primary></indexterm>
952
      <para>Regardless of which of the above you choose, in order to have
944
      <para>Regardless of which of the above you choose, in order to have
953
        mail delivered directly to your host, you must have a permanent
945
        mail delivered directly to your host, it must have a permanent
954
        (static) IP address (no dynamic PPP dial-up).  If you are behind a
946
        static IP address (not a dynamic address, as with most PPP dial-up configurations).  If you are behind a
955
        firewall, it must pass SMTP traffic on to you.  If you want to
947
        firewall, it must pass SMTP traffic on to you.  If you want to
956
        receive mail at your host itself, you need to be sure of one of two
948
        receive mail directly at your host, you need to be sure of either of two
957
        things:</para>
949
        things:</para>
958
950
959
      <itemizedlist>
951
      <itemizedlist>
960
        <indexterm><primary>MX record</primary></indexterm>
952
        <indexterm><primary>MX record</primary></indexterm>
961
        <listitem>
953
        <listitem>
962
          <para>Make sure that the MX record in your DNS points to your
954
          <para>Make sure that the (lowest-numbered) MX record in your DNS points to your
963
	    host's IP address.</para>
955
	    host's IP address.</para>
964
        </listitem>
956
        </listitem>
965
957
Lines 981-987 Link Here
981
973
982
      <para>If that is what you see, mail directly to
974
      <para>If that is what you see, mail directly to
983
        <email>yourlogin@example.FreeBSD.org</email> should work without
975
        <email>yourlogin@example.FreeBSD.org</email> should work without
984
        problems.</para>
976
        problems (assuming <application>sendmail</application> is running correctly on <hostid role="fqdn">example.FreeBSD.org</hostid>).</para>
985
977
986
      <para>If instead you see something like this:</para>
978
      <para>If instead you see something like this:</para>
987
979
Lines 1010-1021 Link Here
1010
freefall		MX	20	who.cdrom.com</programlisting>
1002
freefall		MX	20	who.cdrom.com</programlisting>
1011
1003
1012
      <para>As you can see, <hostid>freefall</hostid> had many MX entries.
1004
      <para>As you can see, <hostid>freefall</hostid> had many MX entries.
1013
        The lowest MX number is the host that ends up receiving the mail in
1005
        The lowest MX number is the host that receives mail directly if available; if it's not accessible for some reason, the others (sometimes called <quote>backup MXes</quote>) accept messages temporarily, and pass it along when a lower-numbered host becomes available, eventually to the lowest-numbered host.</para>
1014
        the end while the others will queue mail temporarily if
1015
        <hostid>freefall</hostid> is busy or down.</para>
1016
1006
1017
      <para>Alternate MX sites should have separate Internet connections
1007
      <para>Alternate MX sites should have separate Internet connections
1018
        from your own in order to be the most useful.  Your ISP or other
1008
        from your own in order to be most useful.  Your ISP or another
1019
        friendly site should have no problem providing this service for
1009
        friendly site should have no problem providing this service for
1020
        you.</para>
1010
        you.</para>
1021
    </sect2>
1011
    </sect2>
Lines 1023-1035 Link Here
1023
    <sect2 id="mail-domain">
1013
    <sect2 id="mail-domain">
1024
      <title>Mail for Your Domain</title>
1014
      <title>Mail for Your Domain</title>
1025
1015
1026
      <para>In order to set up a <quote>mailhost</quote> (a.k.a., mail
1016
      <para>In order to set up a <quote>mailhost</quote> (a.k.a. mail
1027
        server) you need to have any mail sent to various workstations
1017
        server) you need to have any mail sent to various workstations
1028
	directed to it.  Basically, you want to <quote>hijack</quote> any
1018
	directed to it.  Basically, you want to <quote>claim</quote> any
1029
	mail for your domain (in this case <hostid
1019
	mail for any hostname in your domain (in this case <hostid
1030
	role="fqdn">*.FreeBSD.org</hostid>) and divert it to your mail
1020
	role="fqdn">*.FreeBSD.org</hostid>) and divert it to your mail
1031
	server so your users can check their mail via POP or directly on
1021
	server so your users can receive their mail on
1032
	the server.</para>
1022
	the master mail server.</para>
1033
1023
1034
      <indexterm><primary>DNS</primary></indexterm>
1024
      <indexterm><primary>DNS</primary></indexterm>
1035
      <para>To make life easiest, a user account with the same
1025
      <para>To make life easiest, a user account with the same
Lines 1037-1043 Link Here
1037
	<command>adduser</command> to do this.</para>
1027
	<command>adduser</command> to do this.</para>
1038
1028
1039
      <para>The mailhost you will be using must be the designated mail
1029
      <para>The mailhost you will be using must be the designated mail
1040
        exchange for each workstation on the network.  This is done in
1030
        exchanger for each workstation on the network.  This is done in
1041
	your DNS configuration like so:</para>
1031
	your DNS configuration like so:</para>
1042
1032
1043
      <programlisting>example.FreeBSD.org	A	204.216.27.XX		; Workstation
1033
      <programlisting>example.FreeBSD.org	A	204.216.27.XX		; Workstation
Lines 1048-1072 Link Here
1048
	host.</para>
1038
	host.</para>
1049
1039
1050
      <para>You cannot do this yourself unless you are running a DNS
1040
      <para>You cannot do this yourself unless you are running a DNS
1051
        server.  If you are not, or cannot, run your own DNS server, talk
1041
        server.  If you are not, or cannot run your own DNS server, talk
1052
	to your ISP or whoever does your DNS for you.</para>
1042
	to your ISP or whoever provides your DNS.</para>
1053
1043
1054
      <para>If you are doing virtual email hosting, the following
1044
      <para>If you are doing virtual email hosting, the following
1055
        information will come in handy.  For the sake of an example, we
1045
        information will come in handy.  For the example, we
1056
	will assume you have a customer with their own domain, in this
1046
	will assume you have a customer with their own domain, in this
1057
	case <hostid role="domainname">customer1.org</hostid> and you want
1047
	case <hostid role="domainname">customer1.org</hostid>, and you want
1058
	all the mail for <hostid role="domainname">customer1.org</hostid>
1048
	all the mail for <hostid role="domainname">customer1.org</hostid>
1059
	sent to your mailhost, which is named <hostid
1049
	sent to your mailhost, <hostid
1060
	role="fqdn">mail.myhost.com</hostid>.  The entry in your DNS
1050
	role="fqdn">mail.myhost.com</hostid>.  The entry in your DNS
1061
	should look like this:</para>
1051
	should look like this:</para>
1062
1052
1063
      <programlisting>customer1.org		MX	10	mail.myhost.com</programlisting>
1053
      <programlisting>customer1.org		MX	10	mail.myhost.com</programlisting>
1064
1054
1065
      <para>You do <emphasis>not</emphasis> need an A record if you only
1055
      <para>You do <emphasis>not</emphasis> need an A record for <hostid role="domainname">customer1.org</hostid> if you only
1066
        want to handle email for the domain.</para>
1056
        want to handle email for that domain.</para>
1067
	
1057
	
1068
      <note>
1058
      <note>
1069
	<para>Be aware that this means pinging <hostid
1059
	<para>Be aware that pinging <hostid
1070
	  role="domainname">customer1.org</hostid> will not work unless
1060
	  role="domainname">customer1.org</hostid> will not work unless
1071
	  an A record exists for it.</para>
1061
	  an A record exists for it.</para>
1072
      </note>
1062
      </note>
Lines 1082-1088 Link Here
1082
	  <para>Add the hosts to your
1072
	  <para>Add the hosts to your
1083
	  <filename>/etc/mail/local-host-names</filename> file if you are using the
1073
	  <filename>/etc/mail/local-host-names</filename> file if you are using the
1084
	  <literal>FEATURE(use_cw_file)</literal>.  If you are using
1074
	  <literal>FEATURE(use_cw_file)</literal>.  If you are using
1085
	  a version of sendmail earlier than 8.10, the file is
1075
	  a version of <application>sendmail</application> earlier than 8.10, the file is
1086
	  <filename>/etc/sendmail.cw</filename>.</para>
1076
	  <filename>/etc/sendmail.cw</filename>.</para>
1087
	</listitem>
1077
	</listitem>
1088
1078
Lines 1090-1096 Link Here
1090
	  <para>Add a <literal>Cwyour.host.com</literal> line to your
1080
	  <para>Add a <literal>Cwyour.host.com</literal> line to your
1091
	    <filename>/etc/mail/sendmail.cf</filename> or
1081
	    <filename>/etc/mail/sendmail.cf</filename> or
1092
	    <filename>/etc/mail/sendmail.cf</filename> if you are using
1082
	    <filename>/etc/mail/sendmail.cf</filename> if you are using
1093
	    sendmail 8.10 or higher.</para>
1083
	    <application>sendmail</application> 8.10 or higher.</para>
1094
	</listitem>
1084
	</listitem>
1095
      </itemizedlist>
1085
      </itemizedlist>
1096
    </sect2>
1086
    </sect2>

Return to bug 38318