0

I need to send emails to different recipients (many), from my gmail account, the same message for each, but different attachments. So I looked into command line mail clients and stumbled upon this tutorial about setting up sendmail for gmail.

I get errors at the 'install sendmail' and make stages that I need help for.

Subsidiary question: how to get sendmail.mc to be reset to default (the one you see below is copy pasted from one I found online)? removing/installing sendmail doesn't do it.

# apt-get install sendmail sendmail-base sendmail-bin sendmail-cf sendmail-doc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
sendmail-base is already the newest version (8.15.2-3).
sendmail-base set to manually installed.
sendmail-bin is already the newest version (8.15.2-3).
sendmail-bin set to manually installed.
sendmail-cf is already the newest version (8.15.2-3).
sendmail-cf set to manually installed.
sendmail-doc is already the newest version (8.15.2-3).
The following additional packages will be installed:
  procmail sensible-mda
Suggested packages:
  rmail
The following NEW packages will be installed:
  procmail sendmail sensible-mda
0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.
1 not fully installed or removed.
Need to get 0 B/151 kB of archives.
After this operation, 792 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package procmail.
(Reading database ... 259644 files and directories currently installed.)
Preparing to unpack .../procmail_3.22-25ubuntu0.16.04.1_amd64.deb ...
Unpacking procmail (3.22-25ubuntu0.16.04.1) ...
Selecting previously unselected package sensible-mda.
Preparing to unpack .../sensible-mda_8.15.2-3_amd64.deb ...
Unpacking sensible-mda (8.15.2-3) ...
Selecting previously unselected package sendmail.
Preparing to unpack .../sendmail_8.15.2-3_all.deb ...
Unpacking sendmail (8.15.2-3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up sendmail-bin (8.15.2-3) ...
Saving old /etc/mail/sendmail.cf as /etc/mail/sendmail.cf.old ...
Updating sendmail environment ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Could not open /etc/mail/databases(No such file or directory), creating it.
Could not open /usr/share/sendmail-cf/m4/cf.m4(No such file or directory)
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...

Checking filesystem, this may take some time - it will not hang!
  ...   Done.

Checking for installed MDAs...
Adding link for newly extant program (procmail)
sasl2-bin not installed, not configuring sendmail support.

To enable sendmail SASL2 support at a later date, invoke "/usr/share/sendmail/update_auth"


Creating/Updating SSL(for TLS) information
Creating /etc/mail/tls/starttls.m4...
You already have sendmail certificates


*** *** *** WARNING *** WARNING *** WARNING *** WARNING *** *** ***

Everything you need to support STARTTLS (encrypted mail transmission
and user authentication via certificates) is installed and configured
but is *NOT* being used.

To enable sendmail to use STARTTLS, you need to:
1) Add this line to /etc/mail/sendmail.mc and optionally
   to /etc/mail/submit.mc:
  include(`/etc/mail/tls/starttls.m4')dnl
2) Run sendmailconfig
3) Restart sendmail

Checking {sendmail,submit}.mc and related databases...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...
Could not open /usr/share/sendmail-cf/m4/cf.m4(No such file or directory)
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...
Could not open /usr/share/sendmail-cf/m4/cf.m4(No such file or directory)
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/Makefile...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Disabling HOST statistics file(/var/lib/sendmail/host_status).
Creating /etc/mail/sendmail.cf...
m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

Creating /etc/mail/submit.cf...
Informational: confCR_FILE file empty: /etc/mail/relay-domains
Informational: confCT_FILE file empty: /etc/mail/trusted-users
Informational: confUSERDB_SPEC file empty: /etc/mail/userdb.db
Updating /etc/mail/access...
Updating /etc/mail/authinfo/gmail...
Informational: mailertable file empty: /etc/mail/mailertable
Informational: use_ct_file file empty: /etc/mail/trusted-users
Informational: virtusertable file empty: /etc/mail/virtusertable
Updating /etc/aliases...
WARNING: local host name (yogurt) is not qualified; see cf/README: WHO AM I?
newaliases: cannot open /etc/mail/aliases: No such file or directory

Warning: These messages were issued while creating sendmail.cf
    make sure they are benign before starting sendmail!

Errors in generating sendmail.cf
m4:/etc/mail/sendmail.mc:10: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

Job for sendmail.service failed because the control process exited with error code. See "systemctl status sendmail.service" and "journalctl -xe" for details.
invoke-rc.d: initscript sendmail, action "start" failed.
● sendmail.service - LSB: powerful, efficient, and scalable Mail Transport Agent
   Loaded: loaded (/etc/init.d/sendmail; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2018-06-09 12:32:49 EDT; 5ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13910 ExecStart=/etc/init.d/sendmail start (code=exited, status=2)

Jun 09 12:32:49 yogurt sendmail[13910]:  * Starting Mail Transport Agent (MTA) sendmail
Jun 09 12:32:49 yogurt sendmail[13910]: Makefile:343: warning: overriding recipe for target '/etc/aliases.db'
Jun 09 12:32:49 yogurt sendmail[13910]: Makefile:340: warning: ignoring old recipe for target '/etc/aliases.db'
Jun 09 12:32:49 yogurt sendmail[13910]: Makefile:395: warning: overriding recipe for target '/etc/aliases'
Jun 09 12:32:49 yogurt sendmail[13910]: Makefile:340: warning: ignoring old recipe for target '/etc/aliases'
Jun 09 12:32:49 yogurt sendmail[13910]: make: *** No rule to make target '/usr/share/sendmail-cf/m4/cf.m4', nee...Stop.
Jun 09 12:32:49 yogurt systemd[1]: sendmail.service: Control process exited, code=exited status=2
Jun 09 12:32:49 yogurt systemd[1]: Failed to start LSB: powerful, efficient, and scalable Mail Transport Agent.
Jun 09 12:32:49 yogurt systemd[1]: sendmail.service: Unit entered failed state.
Jun 09 12:32:49 yogurt systemd[1]: sendmail.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package sendmail-bin (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up procmail (3.22-25ubuntu0.16.04.1) ...
dpkg: dependency problems prevent configuration of sensible-mda:
 sensible-mda depends on sendmail-bin | mail-transport-agent; however:
  Package sendmail-bin is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not installed.
  Package sendmail-bin which provides mail-transport-agent is not configured yet.

dpkg: error processing package sensible-mda (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                             dpkg: dependency problems prevent configuration of sendmail:
 sendmail depends on sendmail-bin; however:
  Package sendmail-bin is not configured yet.
 sendmail depends on sensible-mda; however:
  Package sensible-mda is not configured yet.

dpkg: error processing package sendmail (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 sendmail-bin
 sensible-mda
 sendmail
E: Sub-process /usr/bin/dpkg returned an error code (1)


# make /etc/init.d/sendmail reload
Makefile:343: warning: overriding recipe for target '/etc/aliases.db'
Makefile:340: warning: ignoring old recipe for target '/etc/aliases.db'
Makefile:395: warning: overriding recipe for target '/etc/aliases'
Makefile:340: warning: ignoring old recipe for target '/etc/aliases'
make: Nothing to be done for '/etc/init.d/sendmail'.
/etc/init.d/sendmail reload
 * Reloading Mail Transport Agent (MTA) sendmail                                                                               Makefile:343: warning: overriding recipe for target '/etc/aliases.db'
Makefile:340: warning: ignoring old recipe for target '/etc/aliases.db'
Makefile:395: warning: overriding recipe for target '/etc/aliases'
Makefile:340: warning: ignoring old recipe for target '/etc/aliases'
make[1]: *** No rule to make target '/usr/share/sendmail-cf/m4/cf.m4', needed by '/etc/mail/databases'.  Stop.

sendmail.mc after update according to tutorial:

# cat sendmail.mc
divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl #     /etc/mail/make
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`debian')dnl
dnl #
dnl # Do not advertize sendmail version.
dnl #
dnl define(`confSMTP_LOGIN_MSG', `$j Sendmail; $b')dnl
dnl #
dnl # default logging level is 9, you might want to set it higher to
dnl # debug the configuration
dnl #
dnl define(`confLOG_LEVEL', `9')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST', `[10.0.2.2]')dnl
dnl #
define(`confDEF_USER_ID', ``8:12'')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl #
dnl # The following allows relaying if the user authenticates, and disallows
dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links
dnl #
dnl define(`confAUTH_OPTIONS', `A p')dnl
dnl # 
dnl # PLAIN is the preferred plaintext authentication method and used by
dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do
dnl # use LOGIN. Other mechanisms should be used if the connection is not
dnl # guaranteed secure.
dnl # Please remember that saslauthd needs to be running for AUTH. 
dnl #
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl #     cd /etc/pki/tls/certs; make sendmail.pem
dnl # Complete usage:
dnl #     make -C /etc/pki/tls/certs usage
dnl #
dnl define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL', `groupreadablekeyfile')dnl
dnl #
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl #
dnl # The following limits the number of processes sendmail can fork to accept 
dnl # incoming messages or process its message queues to 20.) sendmail refuses 
dnl # to accept connections once it has reached its quota of child processes.
dnl #
dnl define(`confMAX_DAEMON_CHILDREN', `20')dnl
dnl #
dnl # Limits the number of new connections per second. This caps the overhead 
dnl # incurred due to forking new sendmail processes. May be useful against 
dnl # DoS attacks or barrages of spam. (As mentioned below, a per-IP address 
dnl # limit would be useful but is not available as an option at this writing.)
dnl #
dnl define(`confCONNECTION_RATE_THROTTLE', `3')dnl
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl #
dnl # For using Cyrus-IMAPd as POP3/IMAP server through LMTP delivery uncomment
dnl # the following 2 definitions and activate below in the MAILER section the
dnl # cyrusv2 mailer.
dnl #
dnl define(`confLOCAL_MAILER', `cyrusv2')dnl
dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # enable both ipv6 and ipv4 in sendmail:
dnl #
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl # 
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl # 
LOCAL_DOMAIN(`future-access.com')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
divert(-1)
#
# This file is used to configure sendmail for use with Debian systems.
#
divert(0)

define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`@(#)sendmail.mc      8.9.3-21 (Debian) 20000309')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE 
undefine(`confHOST_STATUS_DIRECTORY')dnl        #DAEMON_HOSTSTATS 
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE

define(`confSAFE_FILE_ENV',             `/')dnl

LOCAL_CONFIG

define(`SMART_HOST', `SMTP:smtp.int.radiomaranon.org.pe')dnl

MASQUERADE_AS(radiomaranon.org.pe)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(always_add_domain)dnl
Cwowie.int.radiomaranon.org.pe
CGowie.int.radiomaranon.org.pe
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(`nouucp', `reject')dnl

dnl define hosts we relay for
FEATURE(`access_db')dnl
dnl FEATURE(`genericstable', `hash -o /etc/mail/genericstable.db')dnl
dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(accept_unresolvable_domains)

FEATURE(nocanonify)dnl
define(`confSERVICE_SWITCH_FILE',/etc/mail/service.switch)dnl
define(`confBIND_OPTS',`-AAONLY -DNSRCH -DEFNAMES')dnl
dnl  see 'man resolver'
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`SMTP_MAILER_FLAGS',`e')dnl

define(`confTO_QUEUEWARN', `2d')dnl
dnl define(`confDIAL_DELAY', `0')dnl
define(`confCON_EXPENSIVE', `True')dnl

define(`confPRIVACY_FLAGS', `needmailhelo,novrfy,noexpn,noreceipts,noverb')dnl

#GMail settings:
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.db')dnl

MAILER_DEFINITIONS
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

authinfo:

# echo $PWD
/etc/mail/authinfo
# cat authinfo
AuthInfo: U:root I:myuserid@gmail.com P:mypwd
# cat gmail
AuthInfo: "U:root" "I:myuserid@gmail.com" "P:mypwd"
| |
  • UPDATE: It works in spite of the stated errors. Still, I'd like to understand what the errors are about. – Erwann Jun 9 '18 at 17:30
  • Which of the error messages don't you understand? Also, do you realise that Sendmail is a full blown SMTP/mail delivery service (MTA) rather then a mail client (MUA) – davidgo Jun 9 '18 at 18:52
  • No, I didn't realize it. For starters, should I be worried about Errors in generating sendmail.cf m4:/etc/mail/sendmail.mc:10: cannot open /usr/share/sendmail-cf/m4/cf.m4': No such file or directory`? – Erwann Jun 9 '18 at 19:41
  • I strongly suspect you misunderstand how email fits together and are doing the wrong things to achieve your goals the hard way. I'd recommend removing send mail and replacing it with postfix (which will do the identical job - even to the point of allowing you to use the sendmail command - but is orders of magnitude easier to configure and use. – davidgo Jun 9 '18 at 19:48
  • I gave up on sendmail over 10 years ago because of it's aweful configuration, but no, I don't believe you need to worry about this message - it would seem to have to do with the hacks on hacks used by send mail to try generate a manageable config syntax. – davidgo Jun 9 '18 at 19:59
0

While I still believe that you should use mailx instead of full-fledged MTA to send emails via gmail (https://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/) I will give you example of using sendmail+gmail config.

First if all, you need sasl libplain because SMTP auth is based on SASL and Sendmail uses Cyrus SASL (https://www.cyrusimap.org/sasl/) to implement authentication. Make sure to install it, or you will have "AUTH=client, available mechanisms do not fulfill requirements" in your maillog. You also need openssl because sendmail uses it for TLS, but it should be installed already.

CentOS/RH: yum install cyrus-sasl-plain openssl

Ubuntu: apt-get install libsasl2-modules openssl

So, here is my mc file paired with comments.

divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl centos's specific path, you may have different
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl just to force clients obey SMTP
define(`confAUTH_MECHANISMS', `PLAIN')dnl Gmail is OK with SASL-PLAIN when used with TLS
FEATURE(authinfo)dnl This  feature enables /etc/mail/authinfo
define(`SMART_HOST', `smtp.gmail.com')dnl Always send email to this host instead of MX
define(`confTO_IDENT', `0')dnl disable prehistoric IDENT proto
FEATURE(`no_default_msa', `dnl')dnl MSA (567 port) is good idea, but nobody uses it
FEATURE(nouucp, `nospecial')dnl Nobody needs UUCP these days
FEATURE(nocanonify)dnl We assume that client always provides DQDN
EXPOSED_USER(`root')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl Listen localhost:25
MAILER(smtp)dnl The only mailer I need is SMTP, I do not use local mail

Here is /etc/mail/authinfo (make sure to replace [MY_LOGIN_ON_GMAIL] with your actual login) AuthInfo: "I:[MY_LOGIN_ON_GMAIL]@gmail.com" "P:[MY_PASSWORD_ON_GMAIL]" What it means: "Always use AuthInfo for any SMTP connection, using [MY_LOGIN_ON_GMAIL]@gmail.com as login and [MY_PASSWORD_ON_GMAIL]" as password.

You may need to compile this file to hash db (on many OSses you may call make inside of /etc/mail) and convert .mc file to sendmail.cf (command is OS specific, make may work) and restart sendmail (make restart in /etc/mail or ``systemctl restart sendmail'')

Lets try: echo "Hello" | mail -r [MY_LOGIN_ON_GMAIL]@gmail.com -s "Hey, it works" [MY_LOGIN_ON_GMAIL]@gmail.com

-r here is "From".

That is all.

If you have any problems, check /var/log/mail

PS: to check that authinfo ruleset is used by sendmail (which means your changes from mc file are in cf file) use echo "authinfo test test" | sendmail -bt. You should see your login/pass

| |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.