banner



Send mail through the console with authorization in linux - harrisoninupoppeired

Send mail through the console table: In parliamentary law to be aware of everything that happens on the server, in addition to monitoring, it is reusable to follow standard emails that I send to various services. I will order you how to configure the server to send emails through a standard postfix with mandate to a third-party SMTP server. Also, this scene is useful for sending mail finished the Linux console with SMTP authentication.

By default, in a token installation of CentOS 7 already comes fill out mail host suffix. I'm going to function it. Standard server settings do non give tight-laced opportunities to beam mail. Will do some additional actions.

Originall, to be capable to test send chain mail via console, put in the mailx. Without it when you try to send an email to the console leave receive an error:
# postal service bash: mail: command not found

Systematic to fix this, install mailx.

# yum install mailx

After that, you can send from your server messages to the outside Earth, for example.

# df -h | mail-s "Disk usage" admin@mymail.com

The chain armor volition leave behind the output of the command df.

Mail

But with the standard settings, your chain armour will either fall into spam or even not accepted by the receiving server because your server does not have the correct settings for sending ring mail (dns, spf, dkim, etc.). To chain mail normally went IT is necessary to habituate some external post server. Configure postfix to send local mail through with an extraneous server with SMTP authentication.

I took the default configuration of suffix, I clean it from comments and spaces added to the death of your settings.

# hombre /etc/suffix/main.cf
## DEFAULT CONFIG BEGIN ###################### queue_directory = /var/bobbin/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix mail_owner = suffix inet_interfaces = localhost inet_protocols = all unknown_local_recipient_reject_code = 550 alias_maps = hasheesh:/etc/aliases alias_database = hasheesh:/etc/aliases

Produce a file with information about username and password for authorization.

# mcedit /etc/suffix/sasl_passwd
mailsrv.mymail.EN:25 admin@mymail.com:password

Create a db file.

# postmap /etc/postfix/sasl_passwd

You can now restart the postfix and control the act upon.

# systemctl restart postfix

Sent a test netmail via the solace. Check the get off log.

# tail-n 10 /var/log/maillog

If you have thither is a similar error:

postfix/smtp[5420]: admonition: SASL authentication nonstarter: No suitable mechs found postfix/smtp[5420]: 24762774C6: to=<admin@mymail.com>, relay=mailsrv.mymail.com[10.10.30.3]:25, delay=450, delays=450/0.03/0.02/0, dsn=4.7.0, position=deferred (SASL authentication failed; cannot authenticate to server mailsrv.mymail.com[10.10.30.3]: no mechanics available)

You then ask to install some more packages:

# yum install cyrus-sasl Cyrus the Younger-sasl-lib Cyrus-sasl-plain

After that, restart the postfix and check the dispatch console. If everything is in order, to the standard false name for root in /etc/aliases, add together an foreign dea, which will be duplicated mail to the root score. This editable for the specific file, dynamical the last line.

Was:

#root: marc

Became

antecedent: settle down,admin@mymail.com

Updated database of certificates:

# newaliases

That's about it. Now all the mail addressed to local root, for example, reports from corn, will be duplicated to an external letter box, and sending via the perpendicular external mail server. So that mails will normally be delivered without being spam (although not needfully, there are still heuristic rule filters). Now it is convenient to economic consumption a local sending in scripts without specifying additive options. Everything is already configured, you can function a acicular local delivery.

You have Successfully Subscribed!

Source: https://sprintally.com/send-mail-through-the-console/

Posted by: harrisoninupoppeired.blogspot.com

0 Response to "Send mail through the console with authorization in linux - harrisoninupoppeired"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel