sendmail 설정 문제


0

내 Gmail 계정에서 서로 다른 수신자 (많은)에게 이메일을 보내야합니다. 그래서 커맨드 라인 메일 클라이언트를 살펴보고 gmail을위한 sendmail 설정에 관한이 튜토리얼을 우연히 발견했습니다 .

'install 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 {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 :

# 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"

업데이트 : 명시된 오류에도 불구하고 작동합니다. 여전히 오류가 무엇인지 이해하고 싶습니다.
Erwann

이해하지 못하는 오류 메시지는 무엇입니까? 또한 Sendmail은 메일 클라이언트 (MUA)가 아니라 완전한 SMTP / 메일 전송 서비스 (MTA)라는 것을
알고 계십니까

아니요, 몰랐습니다. 우선, Errors in generating sendmail.cf m4:/etc/mail/sendmail.mc:10: cannot open /usr/share/sendmail-cf/m4/cf.m4 ' 에 대해 걱정해야합니까 : 그러한 파일이나 디렉토리가 없습니까?
Erwann

이메일이 어떻게 어울리는 지 잘 모르고 목표를 달성하기 위해 잘못된 일을하고있는 것 같습니다. sendmail을 제거하고 postfix로 바꾸는 것이 좋습니다. sendmail 명령을 사용할 수있을 때까지 동일한 작업을 수행하지만 구성 및 사용이 훨씬 쉽습니다.
davidgo

구성이 훌륭하기 때문에 10 년 전에 sendmail을 포기했지만 아니요,이 메시지에 대해 걱정할 필요가 없다고 생각합니다. 메일을 보내는 데 사용되는 해킹의 해킹과 관련이있는 것으로 보입니다. 관리 가능한 구성 구문
davidgo

답변:


0

나는 여전히 당신이 mailx본격적인 MTA 대신 Gmail을 통해 이메일을 보내야 한다고 생각하지만 ( https://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails- smtp / ) sendmail+ gmail 구성 을 사용하는 예를 제공합니다 .

libplainSMTP 인증이 SASL을 기반으로하고 Sendmail이 Cyrus SASL ( https://www.cyrusimap.org/sasl/ )을 사용하여 인증을 구현 하기 때문에 먼저 모든 경우에 sasl이 필요 합니다. 설치해야합니다. 그렇지 않으면 " AUTH = client, 사용 가능한 메커니즘이 요구 사항을 충족하지 않습니다 "가 있어야 합니다 maillog. opensslsendmail이이를 TLS에 사용하기 때문에 필요 하지만 이미 설치되어 있어야합니다.

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

우분투 : apt-get install libsasl2-modules openssl

자, 여기 내 mc파일이 주석과 쌍을 이루고 있습니다.

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

다음은 /etc/mail/authinfo( [MY_LOGIN_ON_GMAIL]실제 로그인 으로 교체 AuthInfo: "I:[MY_LOGIN_ON_GMAIL]@gmail.com" "P:[MY_PASSWORD_ON_GMAIL]" 해야 함 ) 의미 : "[MY_LOGIN_ON_GMAIL] @ gmail.com을 로그인으로 사용하고 [MY_PASSWORD_ON_GMAIL]"을 비밀번호로 사용하여 SMTP 연결에 항상 AuthInfo를 사용하십시오.

당신은 DB를 해시 (많은 OSses에 전화 할 수 있습니다이 파일을 컴파일해야 할 수도 있습니다 make내부 /etc/mail) 및 변환 .mc에 파일을 sendmail.cf(명령은 특정 OS입니다 make작동 할 수)와 (sendmail을 다시 시작 make restart/etc/mail``systemctl 다시 시작 센드 메일 '을'또는)

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

-r 여기는 "From"입니다.

그게 다야

문제가 있으면 확인하십시오 /var/log/mail

추신 : authinfosendmail 이 규칙 세트를 사용 하는지 확인하십시오 (즉, mc파일 의 변경 사항이 파일에 있음을 의미합니다 cf) echo "authinfo test test" | sendmail -bt. 로그인 / 패스가 보일 것입니다

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.