Sendmail: Difference between revisions
No edit summary |
|||
Line 18: | Line 18: | ||
All '''queued''' email messages with a recipient address that matches: "'''securecomputing.com'''" will be flushed out. You can also use "'''-qS'''" to match on the "'''sender'''" and "'''-qI'''" to match on the "'''queue ID'''". | All '''queued''' email messages with a recipient address that matches: "'''securecomputing.com'''" will be flushed out. You can also use "'''-qS'''" to match on the "'''sender'''" and "'''-qI'''" to match on the "'''queue ID'''". | ||
== How To Configure SSL Relay for verizon.net == | |||
This following shows the procedure and config entries to facilitate using sendmail on an NST system for relay and authentication. | |||
Problem: Verizon blocks TCP port 25, therefore a relay setup to smtp.aol.com (Verizon uses AOL email) is used. Reference: https://www.linuxquestions.org/questions/slackware-14/sendmail-smtp-auth-howto-224543/ | |||
=== Stop the sendmail Service === | |||
systemctl stop sendmail.service; | |||
=== Create authinfo file: "/etc/mail/auth/authinfo" === | |||
Following shows contents of ''/etc/mail/auth/authinfo''. NOTE: Change USERID and PASSWORD to the verizon.net account you will be using to send mail with. | |||
AuthInfo:smtp.aol.com "U:USERID@verizon.net" "P:PASSWORD" "M:PLAIN" | |||
AuthInfo: "U:USERID@verizon.net" "P:PASSWORD" "M:PLAIN" | |||
=== Compile === | |||
cd "/etc/mail/auth"; | |||
makemap hash authinfo < authinfo; | |||
=== Create Relay Entries === | |||
Add the following entries to the file: "/etc/mail/sendmail.mc" | |||
define(`SMART_HOST',`smtp.aol.com')dnl | |||
define(`RELAY_MAILER',`esmtp')dnl | |||
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl | |||
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl | |||
FEATURE(`authinfo',`hash /etc/mail/auth/authinfo')dnl | |||
=== Compile === | |||
cd "/etc/mail"; | |||
m4 sendmail.mc > /etc/mail/sendmail.cf; | |||
=== Start the sendmail Service === | |||
systemctl start sendmail.service; | |||
=== Testing === | |||
You can use the following examples to test the sendmail configuration: | |||
echo "Test from $(hostname) on $(date)" | mailx -v -s "Test from $(hostname)" -r "FROM_EMAIL_ADDR" "TO_EMAIL_ADDR" | |||
mail; | |||
mailq; | |||
tail -6 /var/log/maillog; | |||
sendmail -d0.1 -bv; | |||
== How To Configure SSL Relay for att.net == | |||
This following shows the procedure and config entries to facilitate using sendmail on an NST system for relay and authentication on a residential AT&T Fiber connection circa 2018. It is similar to the Verizon configuration. | |||
Problem: AT&T blocks TCP port 25, therefore a relay setup to smtp.mail.att.net is used. Reference: https://www.linuxquestions.org/questions/slackware-14/sendmail-smtp-auth-howto-224543/ | |||
=== Stop the sendmail Service === | |||
systemctl stop sendmail.service; | |||
=== Create authinfo file: "/etc/mail/auth/authinfo" === | |||
Create the ''auth'' sub-directory (if not present). | |||
install -d /etc/mail/auth | |||
Following shows contents of ''/etc/mail/auth/authinfo''. NOTE: Change USERID and PASSWORD to the att.net account you will be using to send mail with. | |||
AuthInfo:smtp.mail.att.net "U:USERID@att.net" "P:PASSWORD" "M:PLAIN" | |||
AuthInfo: "U:USERID@att.net" "P:PASSWORD" "M:PLAIN" | |||
Change permissions to ''600'' so password can only be viewed by the root user. | |||
chmod 600 /etc/mail/auth/authinfo | |||
=== Compile === | |||
cd "/etc/mail/auth"; | |||
makemap hash authinfo < authinfo; | |||
=== Create Relay Entries === | |||
Add the following entries to the file: "/etc/mail/sendmail.mc". This can go near the end of the file, but needs to be prior to the ''MAILER'' directives. | |||
define(`SMART_HOST',`smtp.mail.att.net')dnl | |||
define(`RELAY_MAILER',`esmtp')dnl | |||
define(`RELAY_MAILER_ARGS', `TCP $h 465')dnl | |||
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl | |||
FEATURE(`authinfo',`hash /etc/mail/auth/authinfo')dnl | |||
=== Compile === | |||
cd "/etc/mail"; | |||
m4 sendmail.mc > /etc/mail/sendmail.cf; | |||
=== Start the sendmail Service === | |||
systemctl start sendmail.service; | |||
systemctl enable sendmail.service; | |||
=== Testing === | |||
You can use the following examples to test the sendmail configuration: | |||
set FROM="USER@DOMAIN" | |||
set TO="USER@DOMAIN" | |||
echo "Test from $(hostname) on $(date)" | mailx -v -s "Test from $(hostname)" -r "${FROM}" "${TO}" | |||
mail; | |||
mailq; | |||
tail -6 /var/log/maillog; | |||
sendmail -d0.1 -bv; |
Revision as of 17:38, 6 June 2018
How To Flush Out All Email Messages From The Sendmail Queue
Sometimes email messages can be queued up with the Mail Transport Agent: "sendmail". The following command line can be used to manually try to immediately flush out All emails queued up by "sendmail". Even though a "sendmail" service may be running, this command is Ok to use, it will only run once and then terminate.
How To Flush Out A Specific Email Message From The Sendmail Queue
"sendmail" can be told to only flush out certain emails from the "queue" with an additional argument to "-q". One can flush email messages that match a specific recipient's address:
All queued email messages with a recipient address that matches: "securecomputing.com" will be flushed out. You can also use "-qS" to match on the "sender" and "-qI" to match on the "queue ID".
How To Configure SSL Relay for verizon.net
This following shows the procedure and config entries to facilitate using sendmail on an NST system for relay and authentication.
Problem: Verizon blocks TCP port 25, therefore a relay setup to smtp.aol.com (Verizon uses AOL email) is used. Reference: https://www.linuxquestions.org/questions/slackware-14/sendmail-smtp-auth-howto-224543/
Stop the sendmail Service
systemctl stop sendmail.service;
Create authinfo file: "/etc/mail/auth/authinfo"
Following shows contents of /etc/mail/auth/authinfo. NOTE: Change USERID and PASSWORD to the verizon.net account you will be using to send mail with.
AuthInfo:smtp.aol.com "U:USERID@verizon.net" "P:PASSWORD" "M:PLAIN" AuthInfo: "U:USERID@verizon.net" "P:PASSWORD" "M:PLAIN"
Compile
cd "/etc/mail/auth"; makemap hash authinfo < authinfo;
Create Relay Entries
Add the following entries to the file: "/etc/mail/sendmail.mc"
define(`SMART_HOST',`smtp.aol.com')dnl define(`RELAY_MAILER',`esmtp')dnl define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo',`hash /etc/mail/auth/authinfo')dnl
Compile
cd "/etc/mail"; m4 sendmail.mc > /etc/mail/sendmail.cf;
Start the sendmail Service
systemctl start sendmail.service;
Testing
You can use the following examples to test the sendmail configuration:
echo "Test from $(hostname) on $(date)" | mailx -v -s "Test from $(hostname)" -r "FROM_EMAIL_ADDR" "TO_EMAIL_ADDR" mail; mailq; tail -6 /var/log/maillog; sendmail -d0.1 -bv;
How To Configure SSL Relay for att.net
This following shows the procedure and config entries to facilitate using sendmail on an NST system for relay and authentication on a residential AT&T Fiber connection circa 2018. It is similar to the Verizon configuration.
Problem: AT&T blocks TCP port 25, therefore a relay setup to smtp.mail.att.net is used. Reference: https://www.linuxquestions.org/questions/slackware-14/sendmail-smtp-auth-howto-224543/
Stop the sendmail Service
systemctl stop sendmail.service;
Create authinfo file: "/etc/mail/auth/authinfo"
Create the auth sub-directory (if not present).
install -d /etc/mail/auth
Following shows contents of /etc/mail/auth/authinfo. NOTE: Change USERID and PASSWORD to the att.net account you will be using to send mail with.
AuthInfo:smtp.mail.att.net "U:USERID@att.net" "P:PASSWORD" "M:PLAIN" AuthInfo: "U:USERID@att.net" "P:PASSWORD" "M:PLAIN"
Change permissions to 600 so password can only be viewed by the root user.
chmod 600 /etc/mail/auth/authinfo
Compile
cd "/etc/mail/auth"; makemap hash authinfo < authinfo;
Create Relay Entries
Add the following entries to the file: "/etc/mail/sendmail.mc". This can go near the end of the file, but needs to be prior to the MAILER directives.
define(`SMART_HOST',`smtp.mail.att.net')dnl define(`RELAY_MAILER',`esmtp')dnl define(`RELAY_MAILER_ARGS', `TCP $h 465')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo',`hash /etc/mail/auth/authinfo')dnl
Compile
cd "/etc/mail"; m4 sendmail.mc > /etc/mail/sendmail.cf;
Start the sendmail Service
systemctl start sendmail.service; systemctl enable sendmail.service;
Testing
You can use the following examples to test the sendmail configuration:
set FROM="USER@DOMAIN" set TO="USER@DOMAIN" echo "Test from $(hostname) on $(date)" | mailx -v -s "Test from $(hostname)" -r "${FROM}" "${TO}" mail; mailq; tail -6 /var/log/maillog; sendmail -d0.1 -bv;