Sendmail forward email
The classic sendmail
forwarding email!
In sendmail
, you can forward emails using the Forward
directive in the sendmail.cf
configuration file. Here's an example:
- Open the
sendmail.cf
file in a text editor. The location of this file varies depending on your system, but it's usually located in/etc/sendmail.cf
or/etc/mail/sendmail.cf
. - Add the following line at the end of the file:
ForwardPath C:/dev/null
This will forward all incoming emails to
/dev/null
, effectively deleting them.
Alternatively, you can forward emails to a specific email address using the following syntax:
ForwardPath /etc/mail/forward
This will forward all incoming emails to the email address specified in the /etc/mail/forward
file.
- Save the changes to the
sendmail.cf
file. - Restart the
sendmail
service to apply the changes:sudo service sendmail restart
- Test the forwarding by sending an email to the email address you're forwarding from.
Note: Make sure to replace /dev/null
or /etc/mail/forward
with the actual path and file name you want to use for forwarding.
Also, keep in mind that sendmail
is an older mail transfer agent, and it's recommended to use a more modern MTA like Postfix or Exim for new installations.