send mail in linux mint

msmtp

  1. install msmtp (synaptic)
  2. global cofiguration file /etc/msmtprc
    # A system wide configuration file is optional.
    # If it exists, it usually defines a default account.
    # This allows msmtp to be used like /usr/sbin/sendmail.
    account default
    
    # The SMTP smarthost
    host lx13.hoststar.hosting
    
    # Use TLS on port 465
    port 465
    tls on
    tls_starttls off
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    
    # Construct envelope-from addresses of the form "user@oursite.example"
    # attention: must be working email, will be verified!!!
    from wa@wlkl.ch
    
    auth on
    user wa@wlkl.ch
    #password ??? # I didn't succeed with keyring ....
    passwordeval cat ???
    
  3. test echo -e "Subject:testfromM\r\n\r\ntext und so weiter\nzwei" | msmtp -v -d 2@wlkl.ch
    • -v -d shows what is going on, errors are send to terminal, or to /var/log/apache2/error.log
    • header must be separated by \n\r and terminated by \r\n\r\n
  4. with to-header (is separate from destination address): echo -e "Subject:testfromM\r\nTo:to@x.y\r\n\r\ntext und so weiter" | msmtp -v -d 2@wlkl.ch
  5. sendmail uses automatically msmtp: echo -e "Subject:test from Sendmai\r\n\r\ntext und so weiter" | sendmail -v -d 2@wlkl.ch
  6. php mail function now also works
  7. mail (synaptic install mailutils, mailjutils doc) also may use msmtp. configure: /etc/mail.rc
    set sendmail="/usr/bin/msmtp -t"
    • echo wie gehts text | mail -s fromMail wa@wlkl.ch
    • echo wie gehts text | mail -s fromMailAttach -A e09Div.jpg wa@wlkl.ch also allows attaments, however fora bug ignores stdin and no body is sent

open

failed attempts

  • ssmtp: many website recommend it. However, it is no longer maintained, I could not bring it to work and normally I couldn't find any error messages