emacs/emacs-mail
Imap emacs configuration
2 way :
smtp configuration
add this to your .emacs conf :
;;send mail using postfix
(setq send-mail-function 'sendmail-send-it)
(setq message-send-mail-function 'message-send-mail-with-sendmail)
Local postfix configuratoin for smtp deliver
installation
# apt install postfix
Configuration type du serveur de messagerie : Système satellite -- Tous les messages sont envoyés vers une autre machine, nommée un smarthost.
Nom de courrier : $(hostname)
Serveur relais SMTP (vide pour aucun) : mail.authsmtp.com
configure your local postfix as relay to a SMTP requiring authentication
edit your main.cf and add these lines:
relayhost = [mail.authsmtp.com]
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl-passwords
smtp_sasl_mechanism_filter = digest-md5
smtp_sasl_security_options=
several smtp
if you use several smtp you have to change relayhost to smtp_tls_per_site:
#relayhost = [mail.authsmtp.com]
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
Contents of /etc/postfix/tls_per_site:
mail.authsmtp.com MUST
smtp.other.net MAY
don’t forget to compile the tls_per_site with postmap.
smtp authentification
then, create with $EDITOR a file called /etc/postfix/sasl-passwords and fill it with something like this:
[mail.authsmtp.com] mypersonnallogin:unmotdepasssecret
then, compile the map file /etc/postfix/sasl-passwords
# postmap /etc/postfix/sasl-passwords
reload your postfix configuration
# systemctl reload postfix
full configuration : exemple
- /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may
smtpd_tls_auth_only=yes
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mycomputer.lan
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, mycomputer, localhost.localdomain, localhost
smtpd_sasl_path=private/auth
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
smtp_sasl_auth_enable=yes
relay_host= [mail.authsmtp.com]
# http://www.postfix.org/SOHO_README.html
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
smtp_sender_dependent_authentication = yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl-passwords
smtp_sasl_mechanism_filter = plain, digest-md5, cram-md5
smtp_sasl_security_options=
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
message_size_limit = 51200000
smtp_use_tls = yes
smtp_tls_wrappermode = yes
smtp_tls_security_level = encrypt
- /etc/postfix/tls_per_site
smtps.ipgp.fr MUST
mail.othersmtp.net MAY
- /etc/postfix/sasl-passwords
[mail.authsmtp.com] mypersonnallogin:unmotdepasssecret
[smtp.other.net] user@other.net:anotherpasswd