shell-scripts - kann keine emails mehr versenden

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • shell-scripts - kann keine emails mehr versenden

    Hallo,

    ich habe viele scripts und cron-jobs etc., die mir eine email schicken, wenn etwas beendet wurde u. ä. Dies klappt aber nicht mehr. Ich hatte immer postfix konfiguriert und konnte immer mails per command line schicken.
    Jetzt bekomme ich es nicht mehr hin, erfolgreich eine Nachricht zu senden. Es gibt zwar Anleitungen im Netz, aber auch die funktionieren jetzt nicht mehr. Selbst ChatGPT 4.o bringt keine funktionierende Lösung.

    Mein Ziel ist es, wieder per Apple (smtp.mail.me.com) emails zu verschicken.

    Für Hinweise wäre ich sehr dankbar.

    fiveyears
  • Bei mir geht das (über smtp.strato) auch nach einem Upgrade auf Sonoma. Bitte mal einen Beispielbefehl schreiben wie Du das versuchst und ob es evtl. irgendwelche Fehlermeldungen gibt. Und Angaben zur macOS-Version und alles was sonst hilfreich sein könnte Dir zu helfen.
  • Danke für die Antwort. Auf meinem Ubuntu-Server mit 1&1-Einstellungen geht es smokt, seit ich noch DKIM eingerichtet habe.
    Auf meinem iMac mit Sonoma und meinem älteren MiMac Pro mit Catalina geht's nicht, wenn ich als Server den iCloud-Server (smtp.mail.me.com) wähle, über den ja auch das Mail-Programm Mails problemlos verschickt. Ich habe das App-Password eingerichtet und komme trotzdem nicht weiter.

    Quellcode

    1. #/etc/postfix/sasl_passw
    2. smtp.mail.me.com:587 <meine email>@me.com:<mein app-password>







    danach:

    Quellcode

    1. sudo postmap /etc/postfix/sasl_passw

    weiter:

    Quellcode: /etc/postfix/main.cf

    1. # Basic configuration
    2. myhostname = <meine domain>.me.com
    3. mydomain = me.com
    4. myorigin = $mydomain
    5. inet_interfaces = all
    6. mydestination = $myhostname, localhost.$mydomain, localhost
    7. relayhost = smtp.mail.me.com:587
    8. # Enable SASL authentication
    9. smtp_sasl_auth_enable = yes
    10. smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    11. smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
    12. smtp_sasl_security_options = noanonymous
    13. smtp_sasl_tls_security_options = noanonymous
    14. # Enable TLS
    15. smtp_use_tls = yes
    16. smtp_tls_security_level = may
    17. # smtp_tls_CAfile = /etc/postfix/ca-bundle.crt - habe ich in einem Beitrag gelesen
    18. # Email size limit
    19. message_size_limit = 10485760
    Alles anzeigen

    danach:

    Quellcode

    1. sudo postfix reload
    log angezeigt:

    Quellcode

    1. log stream --predicate '(process == "smtpd") || (process == "smtp")' --info

    Ergebnis:

    Quellcode

    1. log stream --predicate '(process == "smtpd") || (process == "smtp")' --info
    2. Filtering the log data using "process == "smtpd" OR process == "smtp""
    3. Timestamp Thread Type Activity PID TTL
    4. 2024-07-03 09:12:39.252007+0200 0x36e607c Activity 0x5dd0b80 18396 0 smtp: (libsystem_info.dylib) Retrieve User by Name
    5. 2024-07-03 09:12:39.252480+0200 0x36e607c Activity 0x5dd0b81 18396 0 smtp: (libsystem_info.dylib) Retrieve User by Name
    6. 2024-07-03 09:12:39.252672+0200 0x36e607c Activity 0x5dd0b82 18396 0 smtp: (libsystem_info.dylib) Retrieve Group by Name
    7. 2024-07-03 09:12:39.275651+0200 0x36e607c Activity 0x5dd0b83 18396 0 smtp: (libsystem_info.dylib) Resolve user group list
    8. 2024-07-03 09:12:39.276031+0200 0x36e607c Default 0x0 18396 0 smtp: (libxpc.dylib) [com.apple.xpc:connection] [0x600001cb80f0] activating connection: mach=true listener=false peer=false name=com.apple.SystemConfiguration.DNSConfiguration
    9. 2024-07-03 09:12:39.276223+0200 0x36e607c Default 0x0 18396 0 smtp: (libxpc.dylib) [com.apple.xpc:connection] [0x600001cb80f0] invalidated after the last release of the connection object
    10. 2024-07-03 09:12:40.701667+0200 0x36e607c Info 0x0 18396 0 smtp: 39583848CE65: to=<empfänger@gmail.com>, relay=smtp.mail.me.com[17.42.251.41]:587, delay=1.5, delays=0.03/0.03/1.4/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.mail.me.com[17.42.251.41]: generic failure)
    Es kommt also ein Auth-Fehler, obwohl user und Password stimmen (test per Win-Mail mit gleichen app-password)
    Nehme ich die Zeilen:

    Quellcode

    1. smtp_sasl_security_options = noanonymous
    2. smtp_sasl_tls_security_options = noanonymous

    raus, kommt ein Mesh-Fehler:


    Quellcode

    1. Timestamp Thread Type Activity PID TTL
    2. 2024-07-03 09:16:01.085236+0200 0x36e7c77 Activity 0x5dd2ef0 19466 0 smtp: (libsystem_info.dylib) Retrieve User by Name
    3. 2024-07-03 09:16:01.085696+0200 0x36e7c77 Activity 0x5dd2ef1 19466 0 smtp: (libsystem_info.dylib) Retrieve User by Name
    4. 2024-07-03 09:16:01.085913+0200 0x36e7c77 Activity 0x5dd2ef2 19466 0 smtp: (libsystem_info.dylib) Retrieve Group by Name
    5. 2024-07-03 09:16:01.104432+0200 0x36e7c77 Activity 0x5dd2ef3 19466 0 smtp: (libsystem_info.dylib) Resolve user group list
    6. 2024-07-03 09:16:01.104931+0200 0x36e7c77 Default 0x0 19466 0 smtp: (libxpc.dylib) [com.apple.xpc:connection] [0x600001a3c000] activating connection: mach=true listener=false peer=false name=com.apple.SystemConfiguration.DNSConfiguration
    7. 2024-07-03 09:16:01.105282+0200 0x36e7c77 Default 0x0 19466 0 smtp: (libxpc.dylib) [com.apple.xpc:connection] [0x600001a3c000] invalidated after the last release of the connection object
    8. 2024-07-03 09:16:02.851408+0200 0x36e7c77 Default 0x0 19466 0 smtp: warning: SASL authentication failure: No worthy mechs found
    9. 2024-07-03 09:16:02.866708+0200 0x36e7c77 Info 0x0 19466 0 smtp: 115FE848CFF1: to=<empfänger@gmail.com>, relay=smtp.mail.me.com[17.57.155.28]:587, delay=1.8, delays=0.02/0.03/1.7/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.mail.me.com[17.57.155.28]: no mechanism available)

    Vor einiger Zeit brauchte man gar nicht an postfix rumfummeln, da ging es einfach, weil die Mail-App-Einstellungen irgendwie genutzt wurden (habe ich auch in einem Beitrag gelesen), aber wahrscheinlich sind die Server-Einstellungen jetzt viel strikter.
  • Details habe ich auf die Schnelle nicht angeschaut, aber es sieht so aus als ob der SMTP-Server strikter geworden ist was die Authentication angeht. Bei Strato kam z.B. gestern eine Info dass sie das nächste Woche strenger machen. Vielleicht habe ich dann so ein Problem...
    Das zweite was ich sehe ist dass der Empfänger bei gmail ist. Auch diese wurden strenger und verlangen seit einiger Zeit SPF oder DKIM was Klimmzüge bedeutet wenn man einen Mac als Server im Netz hängen hat der nicht selbst DNS macht.
    Mehr fällt mir im Moment noch nicht ein.
  • Das ist auch eine coole Idee , werde ich mal ausprobieren.
    Die postfix Konfiguration mit gmail funktioniert bei mir wieder, iCloud bekomme ich nicht hin. Ich poste mal die Einstellung für gmail, falls jemand interessiert ist:

    Quellcode

    1. smtp.gmail.com:587 <email>@gmail.com:<app password>



    Quellcode: /etc/postfix/main.cf

    1. relayhost=smtp.gmail.com:587
    2. smtp_sasl_auth_enable=yes
    3. smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
    4. smtp_use_tls=yes
    5. smtp_tls_security_level=encrypt
    6. tls_random_source=dev:/dev/urandom
    7. smtp_sasl_security_options = noanonymous
    8. smtp_always_send_ehlo = yes
    9. smtp_sasl_mechanism_filter = plain
    10. compatibility_level = 2

    dann noch:

    Quellcode

    1. sudo postmap /etc/postfix/sasl_passwd
    2. sudo postfix reload
    3. echo "Test sending email from Postfix" | mail -s "Test Postfix" <empfänger>