-1

If I understand email correctly, I need to setup the smtp configuration before my client can send email to outside domain? If that is the case, where do I set this up in linux's mail/mailx command?

3 Answers 3

1

mail/mailx expects to be able to send mail via a sendmail command (which is traditionally the way to send mail on Unix).

The convention is that there is a command sendmail that accepts a mail on stdin.

While this convention originated with the "sendmail" mailserver (duh), most other mail servers provide such a sendmail command. So you need to setup a locally running mail server, at least for sending mail.

There are many to choose from, most Linux distros set one up for you, usually postfix or Exim. Check your distro's docs for details.

0

If you are on Fedora/Redhat/Centos either Postfix or sendmail is available. Postfix is probably the easier to configure. You will also need an MAA such as Dovecot to retrieve your incoming mail.

0

You can setup postfix email relay through an external smtp server (which can be gmail or your own ISP).

see here:

https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/

and here:

https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay/

after that you can send email from command line, and example from Debian 9 stretch.

Note the -e for echo to allow newline characters, and -r for mailx to show a name along with an outgoing email address:

$ echo -e "testing email via yourisp.com from command line\n\nsent on: $(date)" | mailx -r "Foghorn Leghorn <[email protected]>" -s "test cli email $(date)" -- [email protected]

Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .