проблемы с настройкой sendmail

571
Erwann

Мне нужно отправлять электронные письма разным (многим) получателям из моей учетной записи Gmail, одно и то же сообщение для каждого, но разные вложения. Поэтому я изучил почтовые клиенты командной строки и наткнулся на это руководство по настройке sendmail для gmail .

Я получаю ошибки при установке sendmail и выполняю этапы, для которых мне нужна помощь.

Вспомогательный вопрос: как сделать так, чтобы sendmail.mc был сброшен до значения по умолчанию (то, что вы видите ниже, это копия, вставленная из той, которую я нашел в Интернете)? удаление / установка sendmail не делает этого.

# 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 .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 после обновления в соответствии с руководством:

# 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" 
0
ОБНОВЛЕНИЕ: Это работает несмотря на заявленные ошибки. Тем не менее, я хотел бы понять, в чем ошибки. Erwann 5 лет назад 0
Какое из сообщений об ошибках вы не понимаете? Кроме того, понимаете ли вы, что Sendmail - это полноценная служба доставки SMTP / почты (MTA), а не почтовый клиент (MUA)? davidgo 5 лет назад 0
Нет, я этого не осознавал. Начнем с того, стоит ли мне беспокоиться из-за ошибок в генерации sendmail.cf m4: /etc/mail/sendmail.mc: 10: невозможно открыть `/usr/share/sendmail-cf/m4/cf.m4 ': такого файла нет или каталог`? Erwann 5 лет назад 0
Я сильно подозреваю, что вы неправильно понимаете, как электронная почта соединяется вместе, и делаете неправильные вещи, чтобы нелегко достичь своих целей. Я бы порекомендовал удалить отправку почты и заменить ее на постфикс (который будет выполнять ту же работу - даже до того момента, когда вы сможете использовать команду sendmail), но его на порядок проще настроить и использовать. davidgo 5 лет назад 0
Я отказался от sendmail более 10 лет назад из-за его ужасной конфигурации, но нет, я не верю, что вам нужно беспокоиться об этом сообщении - похоже, оно связано с взломами хаков, используемых отправкой почты, чтобы попытаться сгенерировать управляемый синтаксис конфигурации. davidgo 5 лет назад 0
ХОРОШО. О замене sendmail.mc содержимым по умолчанию? Erwann 5 лет назад 0
Не знаю Какую ОС вы используете? Обычно вы можете удалить пакет и переустановить его вместе с конфигурацией по умолчанию. davidgo 5 лет назад 0

0 ответов на вопрос

Похожие вопросы