title: Sending emails with emacs24 via smtp with gnutls and extra arguments
body: <p>I have a rather weird problem with using sending out emails from emacs24 with my posteo email account, but everything seems to work just fine with gmail and gmx. This is the relevant part of my current .emacs configuration (it feels like I permuted it a million times with always the same results):</p>
  <pre><code>(require 'smtpmail)
  (require 'starttls)
  
  (setq message-send-mail-function 'smtpmail-send-it)
  (setq tls-program '(&quot;gnutls-cli --priority NORMAL:%COMPAT -p %p %h&quot;))
  (setq starttls-gnutls-program &quot;gnutls-cli --priority NORMAL:%COMPAT&quot;)
  (setq starttls-use-gnutls t)
  (setq smtpmail-stream-type 'starttls)
  (setq smtpmail-smtp-server &quot;posteo.de&quot;)
  (setq smtpmail-debug-info t)
  (setq smtpmail-debug-verb t)
  (setq smtpmail-smtp-service 587) ;;587(starttls) or 465(tls/ssl) or ?
  (setq starttls-extra-arguments '(&quot;--priority NORMAL:%COMPAT&quot;))
  </code></pre>
  <p>The output in my <em>message</em> buffer is:</p>
  <pre><code>Sending via mail...
  235 2.7.0 Authentication successful
  gnutls.c: [0] (Emacs) fatal error: A TLS fatal alert has been received.
  gnutls.c: [0] (Emacs) Received alert:  Bad record MAC
  smtpmail-send-command: Process smtpmail not running
  </code></pre>
  <p>and in my <em>trace of SMTP to posteo.de</em> buffer:</p>
  <pre><code>220 mail.posteo.de ESMTP Postfix
  250-mail.posteo.de
  250-PIPELINING
  250-SIZE 76800000
  250-VRFY
  250-ETRN
  250-STARTTLS
  250-ENHANCEDSTATUSCODES
  250-8BITMIME
  250 DSN
  220 2.0.0 Ready to start TLS
  250-mail.posteo.de
  250-PIPELINING
  250-SIZE 76800000
  250-VRFY
  250-ETRN
  250-AUTH PLAIN LOGIN
  250-ENHANCEDSTATUSCODES
  250-8BITMIME
  250 DSN
  AUTH PLAIN &lt;omitted&gt;
  235 2.7.0 Authentication successful
  
  Process smtpmail connection broken by remote peer
  MAIL FROM:&lt;c.bourjau@posteo.de&gt; SIZE=281
  QUIT
  </code></pre>
  <p>The problem seems to be a certificate which appears to have wrong &quot;paddings&quot; (I am not really sure what this is) <a href="http://gnutls.org/manual/html_node/On-Record-Padding.html" rel="nofollow noreferrer">http://gnutls.org/manual/html_node/On-Record-Padding.html</a>. Another way to produce a similar error on the command line with this server is to do:</p>
  <pre><code>$ gnutls-cli --starttls -p 587 posteo.de
  Resolving 'posteo.de'...
  Connecting to '89.146.220.134:587'...
  
  - Simple Client Mode:
  
  220 mail.posteo.de ESMTP Postfix
  *** Starting TLS handshake
  *** Fatal error: An unexpected TLS packet was received.
  *** Handshake has failed
  </code></pre>
  <p>This error is supposedly fixed if one adds the <code>--priority NORMAL:%COMPAT</code> to the gnutls argument which I tried to no avail (see .emacs).</p>
  <p>So the question is: How does on treat certifcates throwing these kind of errors in emacs?</p>
  <p>Thanks a lot in advance!</p>