Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux basic command-sendmail sends mail

Shulou Source: shulou.com Published: 2022-06-02 04:56:49 11月05日 Update

Sendmail

Sendmail is a mail sending agent in postfix, which is responsible for sending mail to a remote server and can receive mail. When sendmail sends an email, it defaults to reading from the tile input to "." To the end.

The scope of application of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.

1. Grammar

Sendmail [option...] [recipient...]

2. List of option parameters

Option

Description

-bd

Enter deamon mode

-bi

Initialize the alias database

-bm

Read messages from standard input

-bp

List mailing list

-bs

Independent smtp mode, read from standard input, output to standard output

-C

Location of main.cf

-F

Specify the full name of the sender

-f

Specify the sender

-I

Ignore lines with only a single point

-Q

Process messages in the queue at a given interval

3. Examples

1) send an email to SB.

[root@localhost ~] # sendmail david / / send email to david. The default sender is root.

one hundred and twenty three。

.

[root@localhost ~] # tail / var/spool/mail/david / / check david mailbox and receive email

Delivered-To: david@david.cn

Received: by mailsrv.david.cn (Postfix, from userid 0)

Id 5B3A7143211; Fri, 5 Oct 2018 21:33:34 + 0800 (CST)

Message-Id:

Date: Fri, 5 Oct 2018 21:33:29 + 0800 (CST)

From: root@david.cn (wejie)

To: undisclosed-recipients:

one hundred and twenty three。

2) specify the sender

[root@localhost ~] # sendmail-f weijie david / / weijie send email to david

Hehe

.

You have new mail in / var/spool/mail/root

[root@localhost ~] # tail / var/spool/mail/david / / check david email. The sender is Wei Jie.

Delivered-To: david@david.cn

Received: by mailsrv.david.cn (Postfix, from userid 0)

Id 3544314308F; Fri, 5 Oct 2018 21:37:11 + 0800 (CST)

Message-Id:

Date: Fri, 5 Oct 2018 21:37:07 + 0800 (CST)

From: weijie@david.cn (wejie)

To: undisclosed-recipients:

Hehe

3) check what fields are in the table

[root@localhost ~] # mysqlshow-u root-p test wj / / displays information about table wj in database test

Enter password:

Database: test Table: wj

+-+

| | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |

+-+

| | id | int (11) | | NO | select,insert,update,references | | |

| | name | text | latin1_swedish_ci | NO | select,insert,update,references | | |

+-+

A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.

Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk

Tags: Mail sender standard input data database mode mailbox output command location information full name content alias parameter only field instance password Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL MariaDB Docker Redmi Xiaomi