Created
November 25, 2020 17:40
-
-
Save souhaiebtar/8e614f3601d90cfdef3a3d3133d0e589 to your computer and use it in GitHub Desktop.
[configure sendmail on ubuntu to enable sending email] configure sendmail in ubuntu #mail #ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### RUN | |
apt install --no-install-recommends sendmail-bin mailutils | |
mkdir -m 700 /etc/mail/authinfo | |
### --- START | |
vim /etc/mail/authinfo/gmail-smtp-auth | |
## add this to file | |
AuthInfo: "U:root" "I:USER@gmail.com" "P:GMAIL_USER_PASSWORD" | |
### --- END | |
### RUN | |
makemap hash /etc/mail/authinfo/gmail-smtp-auth < /etc/mail/authinfo/gmail-smtp-auth | |
### START | |
vim /etc/mail/sendmail.mc | |
## add this to file | |
dnl # Default Mailer setup | |
define(`SMART_HOST',`[smtp.gmail.com]')dnl | |
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl | |
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl | |
define(`confAUTH_OPTIONS', `A p')dnl | |
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl | |
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl | |
FEATURE(`authinfo', `hash -o /etc/mail/authinfo/gmail-smtp-auth.db')dnl | |
MAILER_DEFINITIONS | |
MAILER(`local')dnl | |
MAILER(`smtp')dnl | |
### END | |
### Regenerate sendmail configuration | |
make -C /etc/mail | |
### Reload sendmail | |
/etc/init.d/sendmail reload | |
### test sendmail Gmail relay | |
echo "This is a test for sendmail gmail relay" | sendmail test-user@gmail.com | |
### thanks goes to https://kifarunix.com/configure-sendmail-to-use-gmail-relay-on-ubuntu-18-04-debian-10-9/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment