0

How do I specify a default sender 'from:' address in postfix config for emails through smtp?

I'm trying to send emails through SMTP and a relay from two different servers with Oracle Linux 8

The problem is that on one server when you send an email without the '-r' option to specify a sender it doesn't work returning the following message:

A Sender: field is required with multiple addresses in From: field.
No such file or directory
"/root/dead.letter" 1/6
. . . message not sent.

On the other server, sending an email like this works properly and it sends an email as [email protected]

I'll attach consoles of the attempts on both servers:

Sending Email without -r Option in Server 1

Linux server 5.4.17-2102.201.3.el8uek.x86_64 #2 SMP Fri Apr 23 09:05:57 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux

NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4

[root@server1 ~]# mailx -s "SMTP" [email protected]
test.
.
EOT
A Sender: field is required with multiple addresses in From: field.
No such file or directory
"/root/dead.letter" 1/6
. . . message not sent.
[root@server1 ~]#

Sending email without -r in Server 2

Linux server 5.4.17-2102.201.3.el8uek.x86_64 #2 SMP Fri Apr 23 09:05:57 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux

NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4

[root@server2 ~]# mailx -s "SMTP" [email protected]
test
.
EOT
[root@server2 ~]#

1 Answer 1

0
  1. There are many versions of the mail program, including GNU mailutils and bsd-mailx.

    As mail on server2 seems to work correctly, make sure that server1 has the same version as server2.

  2. Use /usr/sbin/sendmail instead of mail to send your message. You're using postfix on both machines, and postfix's sendmail command understands both -r and -f options to set the sender address. See man postfix for details and more options.

1
  • I was able to use /usr/sbin/sendmail [email protected] to send an email With that command you have to remove the -s option for SMTP thank you.
    – Ricardo
    Commented Jul 9, 2022 at 17:26

You must log in to answer this question.

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