# CRAM-MD5 Authentication for mail

**URL:** https://meta.discourse.org/t/cram-md5-authentication-for-mail/47442
**Category:** Support
**Created:** [July 18, 2016, 3:24am UTC](https://meta.discourse.org/t/cram-md5-authentication-for-mail/47442 "2016-07-18T03:24:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hexa](https://avatars.discourse-cdn.com/v4/letter/h/ed655f/32.png) [@hexa](https://meta.discourse.org/u/hexa)
#### Post date: [July 18, 2016, 3:24am UTC](https://meta.discourse.org/t/cram-md5-authentication-for-mail/47442/1 "2016-07-18T03:24:46Z")

</div>

Hi,

the mailserver i’m using only supports authentication through CRAM-MD5, and from its logs I see that discourse tries to authenticating using SASL PLAIN nevertheless, and obviously not succedding.

Is there a way to set up discourse to authenticate with CRAM-MD5?

```plaintext
220 foobar.net ESMTP Postfix (Debian/GNU)
EHLO barfoo
250-foobar.net
250-PIPELINING
250-SIZE
250-VRFY
250-ETRN
250-AUTH CRAM-MD5
250-AUTH=CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

```

```plaintext
Jul 18 05:21:40 foobar postfix/smtpd[32209]: connect from unknown[82.195.73.13]
Jul 18 05:21:40 foobar postfix/smtpd[32209]: Anonymous TLS connection established from unknown[82.195.x.y]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jul 18 05:21:40 foobar postfix/smtpd[32209]: warning: unknown[82.195.x.y]: SASL PLAIN authentication failed: Invalid authentication mechanism
Jul 18 05:21:40 foobar postfix/smtpd[32209]: lost connection after AUTH from unknown[82.195.x.y]
Jul 18 05:21:40 foobar postfix/smtpd[32209]: disconnect from unknown[82.195.x.y]

```

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [July 18, 2016, 3:35am UTC](https://meta.discourse.org/t/cram-md5-authentication-for-mail/47442/2 "2016-07-18T03:35:49Z")

</div>

Set the `DISCOURSE_SMTP_AUTHENTICATION` environment variable to `cram_md5`. I haven’t tested it, but from a quick rummage through the code, that should do the trick.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:45pm UTC](https://meta.discourse.org/t/cram-md5-authentication-for-mail/47442/3 "2024-06-08T12:45:24Z")

</div>

This topic was automatically closed after 2882 days. New replies are no longer allowed.
