-1

I'm trying to figure out how to get some of our servers to send email through our relay when I use the mail command. If I simply type

$ mail -s "Test" user@domain.com

mail attempts to send directly to the recipient which is not allowed on our network. All email must go through the SMTP server.

I tried using the -- option to pass sendmail options, but I don't know what the option is that I need to pass. I found in another forum that the -S option followed by smtp=smtp://ip.address is the appropriate choice, but that throws an error stating that the -S option doesn't exist.

$ mail -s "Test" user@domain -- -S smtp=smtp://ip.address

Looking at the man page for either mail or sendmail has not clued me into which option I need to use. I did see in the sendmail manpage that there is the -O option which uses the option=value format. I tried that instead of the -S listed above. Still no dice. The manpage even says the -O option is ignored.

Can someone help me out with this?

theillien
  • 445
  • 3
  • 13
  • 28

1 Answers1

1

sendmail is the command to send mail from your local MTA/mailserver, which may or may not be THE server known as Sendmail. Check and see what mailserver you have running. While there's a subset of "compatible" options that every mailserver provides in its sendmail executable, each of them will provide other options for advanced usage, and you'd have to see if your mailserver's version has an option to set a server on an email-by-email basis.

Your best bet, no matter what server you have installed, is to configure the mailserver to use the appropriate SMTP server as a "smarthost" so that your outbound mail always uses it.

DerfK
  • 19,493
  • 2
  • 38
  • 54