Notes on using Mixed Forwarding Systems:
DSMTP has been made to work with all types of forward file,
so if you mix forwarding systems we appreciate that DSMTP's operation
gets rather complicated. Basically, we recommend that you
decide on one way to do forwarding and stick to it. For example, it is not
recommended to let some users do forwarding with a forward file
and let other users use the fwd field of external authentication.
Forward rules, aliases and the
fwd="" field
returned as part of an
External Authentication are
separate forwarding systems that
have precedence over forward files, i.e. If
any of these exist for a user, DSMTP will not look for a forward file.
Having said that, all the other forwarding options have
precedence, a forward file will still affect them if they use a self
referencing option, i.e. where that
system calls for the original recipient to also receive the
message - e.g. $user in a fwd="" field. In these cases, DSMTP has been
told to try to deliver the message to the user (amongst other things) and just
before it writes the drop file it checks for the forward file and, if found,
uses it INSTEAD of delivering to the original recipient.
Here is all the above
in a semi-coded
form for those of you who prefer to read it this way . . .
When DSMTP uses .forward . . .
DSMTP checks or does the following and they MUST ALL be true:
authent_method Unix_user (so not ext. auth)
no_dotforward false
password lookup succeeds
password lookup returns a home directory
If they are all true then DSMTP checks the file,
home_directory/.forward
When DSMTP uses .fwd . . .
if any of the above are NOT true, AND the external authentication
returns an EMPTY fwd="" field OR one with $user,
then it checks the file,
drop_file.fwd
where drop file includes the drop_path (possibly including hashing)
and the drop file name (possibly including drop_prefix and
vdomain_separator), e.g.
d:\dmail\in\t\y\dom1_bob.fwd
To clarify, if the external authentication does return a forward
destination then the .fwd file is not used UNLESS the destination is
self referential - e.g. includes $user. If the destination does
include $user but the .fwd file exists, the original recipient
still won't get the message.
All of the forwarding methods allow you to make DSMTP forward the message to
a special destination of a specific file or program. To do this...
for a robot:
you must
use the pipe symbol, '|' at the start of the destination address.
for a file:
you must include a path character, '/' or '\', which means that you must specify a full
path and filename.
E.g. for a forward rule to write the file to the special UNIX file, /dev/nul,
(it makes things disappear!) you
could have,
forward bob@domainx.com /dev/nul
In this manual we refer
to programs which receive a message (read in on stdin) as a 'robot'.
So, similarly, in order to send Bob's mail to a robot called drespond, you might have
forward bob@domainx.com |c:\dmail\drespond
If you want to make DSMTP take command line arguments for the program or robot, you should include the destination address within quotes, e.g.
forward bob@domainx.com "|c:\dmail\drespond arg1 arg2"
For more information on robots, see
Robots
and specifically on autoresponders, see
Autoresponders - DRespond
DSMTP can be used to route mail on to another server. In order to do this, you
will probably need to use gateway and
forward settings and possibly,
relay_to.
To help you work out which setting to use, this is the very basic
outline of what DSMTP does with a message
when it arrives:
- apply any forward rules
- check if the destination is a local domain (if not then queue it up
for relaying on to the correct destination server (a gateway
setting can be used for non-local domains that will often be
encountered, so that DSMTP does not have to do a DNS lookup)
- (is a local domain) looks for an alias
- then do a lookup on the username (not the
password)
The alias, or the forward or the username lookup (using an external
auth module) can all specify that the message should go to a
different destination, or to a robot. But given that they don't,
DSMTP writes the message to the local user's drop file.
DSMTP has a gateway setting, which has
the syntax,
gateway domain ipaddress
If DSMTP is going to do a DNS MX lookup on the domain specified, it will
instead simply use the ipaddress specified.
In general, this means that the gateway setting will be used for outgoing mail or
for incoming mail that is not destined for the local server (relaying).
FYI . . .
The SMTP protocol was originally intended to allow messages to take
an indirect path from SMTP server to SMTP server in order to reach the server
where the user is considered 'local'. This is message
relaying. These days, a message
will normally go directly from the sending user's local SMTP server directly to
the SMTP server where the destination user is 'local'. This is because the DNS
mail exchange (MX)
lookup done on the destination domain, will normally return the IP address of the
end server and because server administrators tend to not allow mail to pass through
their email server (there is generally no need and it allows spammers to hide).
If you want messages to go via a specific IP address, you can use a gateway
setting to accomplish this. This is often done to allow mail to be sent through
fire walls or where you have distributed internal email servers and you want email
to enter the internet through one point.
(under construction, 16/6/99)
What happens when DSMTP cannot deliver a message?
The answer to this depends on what stage the message has
got to before DSMTP cannot deliver it.
Note: You may like to read the FAQ, Tell me about
the SMTP protocol
- The connecting client is thrown off the server because of where
they are connecting from - e.g. a ban_ip
setting.
- At the Rcpt To: stage of the SMTP protocol.
DSMTP responds with a 500 level SMTP code and a text message
giving the reason for rejection.
This is the best place for DSMTP to reject the message as the sender
will normally get an immediate message from the email client showing
DSMTP's reason for rejection, e.g. the user is not known as
a local user or relaying is not permitted by them.
- At the end of the DATA stage:
DSMTP responds with a 500 level SMTP code and a text message giving
the reason for rejection.
- when a relayed message is rejected by the next server:
DSMTP creates a DSN if it has been requested, otherwise it
bounces the message.
- when a message for a non-local server cannot be delivered YET:
DSMTP queues the message and sends a DELAY DSN if requested. It
then tries to send it again in 2 hours time. It
continues to try to send it up to the number of hours set by the
max_retrytime setting.
Examples of reasons for a message not being able to be delivered
are the DNS server is not responding (so the destination server's
ip address cannot be resolved), the destination server is not responding
or returns a 400 level SMTP code (meaning come back later).
- when DSMTP has accepted a message for local delivery and then
fails to write it to the local user's drop file:
This is very unlikely.
DSMTP would create a DSN message if requested or otherwise
bounce the message.
Settings Affecting Bounces:
Bounces are affected by the following DSMTP settings in dmail.conf:
bounce_body
bounce_maxlen
DSNs:
Delivery Status Notifications can be requested as part of the
Extended SMTP (ESMTP) protocol.
This is done on the end of the RCPT TO: line of the SMTP protocol
with the NOTIFY command.
E.g.
RCPT TO:<bob@domain> NOTIFY=FAILURE
requests that the sender wants to be notified of a failure to
deliver to bob@domain.
The NOTIFY command can take the value NEVER or one or more of,
SUCCESS,FAILURE,DELAY.
Some examples:
RCPT TO:<bob@domain> NOTIFY=SUCCESS
RCPT TO:<bob@domain> NOTIFY=FAILURE,DELAY
Where:
+ A NOTIFY parameter value of "NEVER" requests that a DSN not be
returned to the sender under any conditions.
+ A NOTIFY parameter value containing the 'SUCCESS' or
'FAILURE'
keywords requests that a DSN be issued on successful delivery or
delivery failure, respectively.
+ A NOTIFY parameter value containing the keyword 'DELAY' indicates the
sender's willingness to receive 'delayed' DSNs. Delayed DSNs may be
issued if delivery of a message has been delayed for an unusual amount
of time,
but the final delivery status (whether successful or failure) cannot
be determined. The absence of the DELAY keyword in a NOTIFY parameter
requests that a 'delayed' DSN NOT be issued under any conditions.
See also, I got a bounce (Delivery Status Notification) message from DSMTP ...
for a list of explanations of common DSN and bounce messages.
- How to redirect but do the normal delivery as well:
(e.g. fred wants a copy of bob's mail,
but bob still wants to receive it too)
Mail re-direction usually means that the original recipient does not get the message, but
it is easy to instruct DSMTP to carry out the delivery as well as the re-direction.
a) Using Forward settings: use a forward carbon copy.
forward_cc bob@domain1.com fred@domain2.com
results in mail addressed to bob@domain1.com being re-directed to fred@domain2.com
AND still going into bob's mailbox, bob@domain1.com.
b)In alias files: use the special destination, $user, in the alias file destination.
bob: $user,fred@domain2.com
results in bob getting his mail as normal, and fred@domain2.com also getting a copy.
- How to forward multiple copies:
(fred and john want to receive all mail addressed to sales)
a) use multiple forward settings as all matching forward settings will be applied.
forward sales@domain1.com fred@domain1.com
forward sales@domain1.com john@domain2.com
results in fred and john receiving mail addressed to sales@domain1.com and the sales
mailbox does not get any mail (fred and john could be at any destination domain).
b)In alias files: give a comma separated list of destinations.
sales: fred@domain2.com,john@domain2.com
results in fred and john receiving mail addressed to 'sales', instead of it going to the
'sales' mailbox. By specifying the domain to which the alias file applies, you can control
which domains this alias exists for. See the next example...
- How do you set up an alias on all local domains?
(bob wants to get mail addressed to sales@*)
If bob really wants mail addressed to the user 'sales' at any domain which passes through
DSMTP (incoming AND outgoing) then simply use a forward setting,
forward sales@* bob@domain1.com
Note - if bob tries to send a message to sales@othercompany.com then he will find his
outgoing message gets re-directed back to him!
What is more likely is that you only want bob to get mail addressed to sales at LOCAL domains.
Option 1:
If you add a domain as an alias of the main domain, by adding host_domain settings after your
main domain, e.g.
host_domain domain1.com
host_domain domain2.com
host_domain domain3.com
then the user sales, will automatically have the aliases,
sales@domain1.com
sales@domain2.com
sales@domain3.com
so then all you have to add is an alias to redirect mail from sales@domain1.com to
bob@domain1.com. One way to do this is to add the following alias to the domain1.com alias file,
sales: bob@domain1.com
(use the following line to tell DSMTP about the domain1.com alias file,
alias_file_domain domain1.com c:\dmail\dom1aliases.txt )
Option 2:
You can use alias files to create the sales alias for any local domain, by specifying an
alias file with the wildcard character.
The alias_file_domain setting has the syntax,
alias_file_domain <domain> <filename>
You can specify that the file contains aliases for all domains with the wildcard character, i.e.
alias_file_domain * c:\dmail\global_aliases.txt
If you just want the alias for domains, domain1.com, domain2.com and domain3.com then point 3 settings
at the same file, i.e.
alias_file_domain domain1.com c:\dmail\aliases_group1.txt
alias_file_domain domain2.com c:\dmail\aliases_group1.txt
alias_file_domain domain3.com c:\dmail\aliases_group1.txt
The domains, domain1.com, domain2.com and domain3.com can be declared as local with either a
host_domain or vdomain line.
In both cases, use the following line to add the alias in the alias file which you have specified
sales: bob@domain1.com
Yes, DMail supports the ETRN protocol as part of its support for
Extended SMTP, ESMTP. This allows you to host or gateway for domains which
are located on a 'remote' or 'dial up' server.
Basically, if another SMTP server sends DMail the ETRN command,e.g.,
ETRN domainx.com
DSMTP will try to send any mail in its outgoing queue waiting
for that domain.
NB: DMail handles the queuing of mail for a 'dial up' domain
automatically as part of its normal message queuing. If
a connection cannot be established to the destination server
(i.e. the dial up server that is one of your ETRN domains),
DSMTP queues the message and tries to send it every 2 hours up
to a limit set by the setting,
max_retrytime.
So in theory, to host an ETRN domain you don't have to do anything, DMail
does it automatically.
However, in practice you probably need to set a,
gateway
setting for the domain and you will probably also need to set your
SPAM rules so that users can relay mail through your
server to that domain. The easiest way to do this is generally with the
relay_to
dmail.conf setting.
We have recently added a setting to version 2.8b,
suspend_domain
which can be useful. You can set it to suspend all mail for
a specified domain, so that DSMTP does not try to send the mail every 2 hours.
This
setting does not affect the ETRN command, so that when an ETRN is received
for the domain, DSMTP will still send all mail queued for it. NB: This
can be a little dangerous because if a domain did not dial up and send ETRN for
2 months, any waiting mail would not get bounced to the sender.
DSMTP can also send the ETRN command, which allows it to act as the
'remote' or 'dial up' server. It sends the ETRN command as part of the
ras_timer RAS dial up setting.