Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.