2

I've installed mailx, and when I try to send an email, like:

echo "Test" | mailx -r "[email protected]" -s "Test" "[email protected]"

It executes. But I don't receive the email. How do I set mailx up to send to Gmail, while retaining the ability to customize the sender ID?

8
  • Did you check your Spam in the Gmail account? I can send mails from command line and also use the -r option. But those mails end up in the spam folder. Commented Jun 17, 2017 at 11:08
  • Yes, I checked Spam. How did you do this? Are you able to change the sender's name as well? Commented Jun 17, 2017 at 11:09
  • Yes I could change the senders address. I have a postfix running, which sends the mail. Not sure how your setup is in detail, but you also might want to check the logfile of your MTA. Commented Jun 17, 2017 at 11:21
  • I'll try setting up postfix again. What are the steps I need to follow, and the specific configuration options I need to set? Commented Jun 17, 2017 at 11:25
  • Configfiles for postfix looks pretty default for me. Commented Jun 17, 2017 at 11:27

1 Answer 1

1

You can't do this without some form of authentication that you are the correct user.

https://en.wikipedia.org/wiki/Email_spoofing

This used to be a big problem, before people fixed it with cryptographic signatures. You could receive an email from a criminal, pretending to be your boss, asking you to send them the secret project of the future.

If you host your own mail server, you will be able to customise the username, but you will either need to have some way of keeping your IP constant (or replies will not work), or DDNS.

EDIT:

as @tripleee mentioned, this has to be set up as SMTP settings, this is not a mailx problem

3
  • 1
    Maybe point out that the authentication needs to be configured on the SMTP level, and isn't a Mailx problem directly at all. Commented Jun 16, 2017 at 18:28
  • Ah right that makes sense. Can I change the sender name as long as it isn't a Gmail ID then? Like an ID from a private server? Commented Jun 17, 2017 at 11:10
  • If you have a mail server, or one that will give you the address you want, then you can use that name. Have a look at en.wikipedia.org/wiki/Email_authentication Commented Jun 17, 2017 at 11:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.