How to send email to multiple recipients in mailx command ?

Today in this post, we will see how to send email to multiple recipients using mailx command.

First lets see how to send it to single user and multiple users.

1. Sending to single email ID.
Mention the email body message and press Ctrl+D to send the message which will print “EOT”.
We will see in next step how to avoid pressing Ctrl+D.

[root@ngelinux001 ~]# mailx -s "test1" support@ngelinux.com
hi^Hello
hi
EOT
[root@ngelinux001 ~]#

 

2. Sending to multiple email IDs in a script.

[root@ngelinux001 ~]# mailx -s "test1" "support@ngelinux.com support@ngelinux.com" < /dev/null
Null message body; hope that's ok
[root@ngelinux001 ~]#

We can use the above command in a script as well.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments