PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : mail-Befehl auf der Kommandozeile



ganesch
01.03.05, 10:12
Hallo,

ich habe jetzt glaube ich alle Beiträge zu diesem Thema in diesem Forum gelesen, doch ich werd' nicht so ganz schlau draus.

Ich möchte von der Kommandozeile Mails verschicken können und habe deswegen gerade noch sendmail nachinstalliert (unter Red Hat 9). Sendmail wird beim Booten korrekt gestartet.

Ich benutze folgenden Befehl:

mail -s Test nick@openstream.ch
Test
.

In /var/log/maillog wird folgendes aufgezeichnet:

Mar 1 10:38:17 localhost sendmail[2105]: j219bvKq002105: to=nick@openstream.ch, delay=00:00:20, mailer=esmtp, pri=30039, dsn=4.4.3, stat=queued

Kann mir jemand bitte einen Debugging-Tipp geben? Ist es normal, dass die E-Mail gequeued wird?

Muss ich wirklich keinen DNS-Server laufen haben, um Mails verschicken zu können?

Muss ich evtl. sendmail noch nachkonfigurieren, damit es funzt? Wenn ja wie?

RichieX
01.03.05, 13:03
Muss ich evtl. sendmail noch nachkonfigurieren, damit es funzt? Wenn ja wie?

Ja. Suche unter "Smarthost".

RichieX

ganesch
01.03.05, 13:22
Unter smarthost in /etc/mail/sendmail.cf finde ich folgende Zeile:


# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name

Meinst du das? In was soll ich name ändern?

RichieX
01.03.05, 15:09
Nimm bitte die /etc/mail/sendmail.mc, mit der kann man besser arbeiten. Nach Bearbeitung einfach "m4 sendmail.cf < sendmail.mc"

Authentifizierung, wenn nötig, nicht vergessen.

RichieX

ganesch
01.03.05, 22:25
Hi RichieX,

vielen Dank für deine Hilfe.

Deine prägnant formulierten Aussagen verunsichern mich ein wenig.

Ich müsste also bei

dnl define(`SMART_HOST',`smtp.your.provider')

den smtp-Server meines Providers angeben, wenn ich das richtig verstehe. Geht das nicht direkter?

Hier meine 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 # make -C /etc/mail
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for Red Hat Linux')dnl
OSTYPE(`linux')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 #
dnl define(`SMART_HOST',`smtp.your.provider')
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 /usr/share/ssl/certs; make sendmail.pem
dnl # Complete usage:
dnl # make -C /usr/share/ssl/certs usage
dnl #
dnl define(`confCACERT_PATH',`/usr/share/ssl/certs')
dnl define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
dnl define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')
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',`groupreadablekey file')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',`/usr/sbin/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 12.) sendmail refuses
dnl # to accept connections once it has reached its quota of child processes.
dnl #
dnl define(`confMAX_DAEMON_CHILDREN', 12)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 # 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 #
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(`localhost.localdomain')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 #
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

RichieX
02.03.05, 17:29
Hi RichieX,
Ich müsste also bei
dnl define(`SMART_HOST',`smtp.your.provider')
den smtp-Server meines Providers angeben, wenn ich das richtig verstehe.

Richtig.
Das sind die dafür wichtigen Einträge:


define(`SMART_HOST',`smtp.your.provider')
dnl Zusaetzliche Optionen bei Authentifizierung:
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

Wietere Informationen findest du hier: http://www.google.de/search?hl=de&q=sendmail+smtpauth&meta=

RichieX

ganesch
03.03.05, 09:10
Ich glaube, dass das alles nichts mit sendmail.mc zu tun hat, denn ich habe gerade die sendmail.mc von meinem Laptop (Fedora Core 3) auf meinen Desktop PC (Redhat 9) kopiert, dann


m4 sendmail.cf < sendmail.mc
/etc/init.d/sendmail reload

... doch das maillog bleibt dasselbe

Mar 3 09:58:25 localhost sendmail[2866]: j238w5Vm002866: to=nick.weisser@openstream.ch, delay=00:00:20, mailer=esmtp, pri=30046, dsn=4.4.3, stat=queued

Das maillog auf meinem Laptop sieht folgendermassen aus

Mar 3 10:01:04 localhost sendmail[10034]: j2390vS3010032: to=<nick@openstream.ch>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:07, xdelay=00:00:06, mailer=esmtp, pri=120339, relay=mail.openstream.ch. [83.246.77.147], dsn=2.0.0, stat=Sent (Ok: queued as CA8F2195003A)


Warum wird mein Mail gequeued?

Hast du eine Idee, was ich sonst noch machen könnte? :confused:

RichieX
03.03.05, 09:34
/etc/init.d/sendmail reload

... gibt es unter RH9 nicht (bei der Std.-rpm)

nimm ... restart

RichieX

ganesch
03.03.05, 10:23
Habe es nochmals mit restart versucht, doch mein maillog sagt immer noch das gleiche

Mar 3 11:11:43 localhost sendmail[2933]: j23ABNhR002933: to=info@openstream.ch, delay=00:00:20, mailer=esmtp, pri=30038, dsn=4.4.3, stat=queued

Könnte es vielleicht sein, dass unter Fedora Core 3 irgendwelche Dienste laufen, die unter Redhat 9 nicht laufen (DNS-Server, etc.)? Ich verstehe nicht, weshalb die blöden Mails gequeued werden. In sendmail.mc gibt es auch keine Konfigurationseinstellung für "queued".

Ich glaub' ich geb's auf :(

RichieX
03.03.05, 18:21
Füge mal folgende Zeile in die mc-Datei ein:


define(`confDELIVERY_MODE', `background')

und erzeuge die cf neu und restarte sendmail

RichieX

Edit: PS: Versuche doch mal an der Konsole mit "sendmail -v -q" die Queue zu leeren.

ganesch
15.03.05, 11:11
Immer noch das gleiche Problem, trotz den Änderungen, die du vorgeschlagen hast.
Vielleicht geben diese beiden Mails einen Hinweis. Da ist die Rede von einem Name Server Timeout.

Return-Path: <MAILER-DAEMON@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
localhost.localdomain (8.12.8/8.12.8) with ESMTP id j21Eb4jW002222 for
<nwe@localhost.localdomain>; Tue, 1 Mar 2005 15:37:04 +0100
Received: from localhost (localhost) by localhost.localdomain
(8.12.8/8.12.8/Submit) id j21EaiSG002221; Tue, 1 Mar 2005 15:37:04 +0100
Date: Tue, 1 Mar 2005 15:37:04 +0100
From: Mail Delivery Subsystem <MAILER-DAEMON@localhost.localdomain>
Message-Id: <200503011437.j21EaiSG002221@localhost.localdomain>
To: nwe@localhost.localdomain
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status; boundary="j21EaiSG002221.1109687824/localhost.localdomain"
Subject: Warning: could not send message for past 4 hours
Auto-Submitted: auto-generated (warning-timeout)
X-Evolution-Source: mbox:/var/spool/mail/nwe

This is a MIME-encapsulated message

--j21EaiSG002221.1109687824/localhost.localdomain

**********************************************
** THIS IS A WARNING MESSAGE ONLY **
** YOU DO NOT NEED TO RESEND YOUR MESSAGE **
**********************************************

The original message was received at Tue, 1 Mar 2005 10:37:57 +0100
from nwe@localhost

----- Transcript of session follows -----
451 openstream.ch: Name server timeout
Warning: message still undelivered after 4 hours
Will keep trying until message is 5 days old

--j21EaiSG002221.1109687824/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Arrival-Date: Tue, 1 Mar 2005 10:37:57 +0100

Final-Recipient: RFC822; nick@openstream.ch
Action: delayed
Status: 4.4.3
Last-Attempt-Date: Tue, 1 Mar 2005 15:37:04 +0100
Will-Retry-Until: Sun, 6 Mar 2005 10:37:57 +0100

--j21EaiSG002221.1109687824/localhost.localdomain
Content-Type: message/rfc822

Return-Path: <nwe>
Received: (from nwe@localhost) by localhost.localdomain
(8.12.8/8.12.8/Submit) id j219bvKq002105 for nick@openstream.ch; Tue, 1 Mar
2005 10:37:57 +0100
Date: Tue, 1 Mar 2005 10:37:57 +0100
From: Nick Weisser <nwe>
Message-Id: <200503010937.j219bvKq002105@localhost.localdomain>
To: nick@openstream.ch
Subject: test4
Mime-Version: 1.0

test4

--j21EaiSG002221.1109687824/localhost.localdomain--

Return-Path: <MAILER-DAEMON@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
localhost.localdomain (8.12.8/8.12.8) with ESMTP id j26ABCZ8011706 for
<nwe@localhost.localdomain>; Sun, 6 Mar 2005 11:11:12 +0100
Received: from localhost (localhost) by localhost.localdomain
(8.12.8/8.12.8/Submit) id j26AAq9b011705; Sun, 6 Mar 2005 11:11:12 +0100
Date: Sun, 6 Mar 2005 11:11:12 +0100
From: Mail Delivery Subsystem <MAILER-DAEMON@localhost.localdomain>
Message-Id: <200503061011.j26AAq9b011705@localhost.localdomain>
To: nwe@localhost.localdomain
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status; boundary="j26AAq9b011705.1110103872/localhost.localdomain"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
X-Evolution-Source: mbox:/var/spool/mail/nwe

This is a MIME-encapsulated message

--j26AAq9b011705.1110103872/localhost.localdomain

The original message was received at Tue, 1 Mar 2005 10:37:57 +0100
from nwe@localhost

----- The following addresses had permanent fatal errors -----
nick@openstream.ch

----- Transcript of session follows -----
451 openstream.ch: Name server timeout
Message could not be delivered for 5 days
Message will be deleted from queue

--j26AAq9b011705.1110103872/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Arrival-Date: Tue, 1 Mar 2005 10:37:57 +0100

Final-Recipient: RFC822; nick@openstream.ch
Action: failed
Status: 4.4.7
Last-Attempt-Date: Sun, 6 Mar 2005 11:11:12 +0100

--j26AAq9b011705.1110103872/localhost.localdomain
Content-Type: message/rfc822

Return-Path: <nwe>
Received: (from nwe@localhost) by localhost.localdomain
(8.12.8/8.12.8/Submit) id j219bvKq002105 for nick@openstream.ch; Tue, 1 Mar
2005 10:37:57 +0100
Date: Tue, 1 Mar 2005 10:37:57 +0100
From: Nick Weisser <nwe>
Message-Id: <200503010937.j219bvKq002105@localhost.localdomain>
To: nick@openstream.ch
Subject: test4
Mime-Version: 1.0

test4

--j26AAq9b011705.1110103872/localhost.localdomain--

ganesch
15.03.05, 11:28
Ich habe die beiden direkten Nameserver meines Providers in der Red Hat Network Configuration eingetragen und den DNS-Eintrag des Routers, der dort standardmässig war, an die 3. Stelle verbannt :ugly:

Yippieeee!:D