[GH-ISSUE #22] [Bug] Cannot send emails in Solus Linux using an Exchange account #20

Closed
opened 2026-03-03 01:19:03 +03:00 by kerem · 23 comments
Owner

Originally created by @d99kris on GitHub (Jan 29, 2020).
Original GitHub issue: https://github.com/d99kris/nmail/issues/22

Originally assigned to: @d99kris on GitHub.

From @kabouik in #13:

this account still seems to have issue for sending emails. Receiving works, saving drafts works (but see #17), but sending always fails, with or without attachments, from drafts or newly composed message, while similar messages sent from other accounts work fine.

Originally created by @d99kris on GitHub (Jan 29, 2020). Original GitHub issue: https://github.com/d99kris/nmail/issues/22 Originally assigned to: @d99kris on GitHub. From @kabouik in #13: > this account still seems to have issue for sending emails. Receiving works, saving drafts works (but see #17), but sending always fails, with or without attachments, from drafts or newly composed message, while similar messages sent from other accounts work fine.
kerem closed this issue 2026-03-03 01:19:04 +03:00
Author
Owner

@d99kris commented on GitHub (Jan 29, 2020):

Hi @kabouik - please help share a log-file for when sending fails, and I'll take a look. If you could drop a note here as well when you've sent the log-file it would be great, as I don't check my spam-folder all the time.

<!-- gh-comment-id:579702997 --> @d99kris commented on GitHub (Jan 29, 2020): Hi @kabouik - please help share a log-file for when sending fails, and I'll take a look. If you could drop a note here as well when you've sent the log-file it would be great, as I don't check my spam-folder all the time.
Author
Owner

@Kabouik commented on GitHub (Jan 29, 2020):

Thanks, I'll send you a log file later today.

This is a good excuse to ask you how to add attachments with nmail (#23).

<!-- gh-comment-id:579782381 --> @Kabouik commented on GitHub (Jan 29, 2020): Thanks, I'll send you a log file later today. This is a good excuse to ask you how to add attachments with nmail (#23).
Author
Owner

@Kabouik commented on GitHub (Jan 29, 2020):

I just sent you the log file (hopefully it went through). However I forgot to add myself as CC and I used disroot.org, so I can't check myself due to #20.

<!-- gh-comment-id:579796805 --> @Kabouik commented on GitHub (Jan 29, 2020): I just sent you the log file (hopefully it went through). However I forgot to add myself as CC and I used disroot.org, so I can't check myself due to #20.
Author
Owner

@d99kris commented on GitHub (Jan 30, 2020):

Unfortunately I did not receive any email (yep checked my Spam folder as well). Could you try send again (d99kris at gmail dot com)? Perhaps you could try sending using a different email client (although I don't have issues sending email attachments using nmail myself).

<!-- gh-comment-id:580202920 --> @d99kris commented on GitHub (Jan 30, 2020): Unfortunately I did not receive any email (yep checked my Spam folder as well). Could you try send again (d99kris at gmail dot com)? Perhaps you could try sending using a different email client (although I don't have issues sending email attachments using `nmail` myself).
Author
Owner

@Kabouik commented on GitHub (Jan 30, 2020):

I just sent the message again, with a different client this time.

<!-- gh-comment-id:580234986 --> @Kabouik commented on GitHub (Jan 30, 2020): I just sent the message again, with a different client this time.
Author
Owner

@d99kris commented on GitHub (Jan 31, 2020):

Thanks! I received the email. In the log I see

GnuTLS error: An unexpected TLS packet was received.

But I'm not sure what causes it. Just for my reference so I know what library versions you are using, could you help run

ldd `which nmail`

and share the output?

<!-- gh-comment-id:580683313 --> @d99kris commented on GitHub (Jan 31, 2020): Thanks! I received the email. In the log I see ``` GnuTLS error: An unexpected TLS packet was received. ``` But I'm not sure what causes it. Just for my reference so I know what library versions you are using, could you help run ``` ldd `which nmail` ``` and share the output?
Author
Owner

@d99kris commented on GitHub (Jan 31, 2020):

Actually I might not need the ldd output, I did a test using an outlook account on a Linux system and I am also encountering some send issue. Hopefully it's the same issue you are facing. Let me try debug.

<!-- gh-comment-id:580684800 --> @d99kris commented on GitHub (Jan 31, 2020): Actually I might not need the `ldd` output, I did a test using an outlook account on a Linux system and I am also encountering some send issue. Hopefully it's the same issue you are facing. Let me try debug.
Author
Owner

@d99kris commented on GitHub (Jan 31, 2020):

The issue I faced on Linux with Outlook was trying to send using port 465. Once I switched to 587 the problem went away. Perhaps you could try using port 587 - just to see if it makes any difference?

In ~/.nmail/main.conf it's the following line:
smtp_port=587

<!-- gh-comment-id:580693012 --> @d99kris commented on GitHub (Jan 31, 2020): The issue I faced on Linux with Outlook was trying to send using port 465. Once I switched to 587 the problem went away. Perhaps you could try using port 587 - just to see if it makes any difference? In `~/.nmail/main.conf` it's the following line: ```smtp_port=587```
Author
Owner

@Kabouik commented on GitHub (Feb 1, 2020):

It seems to work indeed. Weird, I remembered I actually started with STARTTLS and 587 but it didn't work, and then changed it to 465 to check if it would be better (it was not). Most likely, it was on my computer that fails to send from any account. On the phone, I confirm STARTTLS works on an Exchange account. Thanks.

Problem half solved because I know from other clients that 465 should work too with this account.

<!-- gh-comment-id:581036146 --> @Kabouik commented on GitHub (Feb 1, 2020): It seems to work indeed. Weird, I remembered I actually started with STARTTLS and 587 but it didn't work, and then changed it to 465 to check if it would be better (it was not). Most likely, it was on my computer that fails to send from any account. On the phone, I confirm STARTTLS works on an Exchange account. Thanks. Problem half solved because I know from other clients that 465 should work too with this account.
Author
Owner

@d99kris commented on GitHub (Feb 2, 2020):

Ok, thanks for checking!

Problem half solved because I know from other clients that 465 should work too with this account.

Ok, yep we'll leave the bug open. Hopefully I'll encounter some other SMTP server where I can reproduce the same problem you were seeing. It turns out the issue I faced when using outlook.com was "connection refused" on port 465, so most likely a server-side issue and not the same issue you were facing.

<!-- gh-comment-id:581111901 --> @d99kris commented on GitHub (Feb 2, 2020): Ok, thanks for checking! > Problem half solved because I know from other clients that 465 should work too with this account. Ok, yep we'll leave the bug open. Hopefully I'll encounter some other SMTP server where I can reproduce the same problem you were seeing. It turns out the issue I faced when using outlook.com was "connection refused" on port 465, so most likely a server-side issue and not the same issue you were facing.
Author
Owner

@d99kris commented on GitHub (Feb 10, 2020):

Hi again!
I've done some additional tests on the only Exchange server I have access to smtp-mail.outlook.com and even using other email clients (Thunderbird) it does not accept sending emails using SSL/TLS (port 465). It only accepts STARTTLS (port 587).

Could you please help double-check that you are able to send using SSL/TLS (port 465) with other email clients with your Exchange server?

The reason for asking is that nmail is working fine for me to send emails using SSL/TLS (port 465) for other email service providers that does support it.

Thanks!

<!-- gh-comment-id:584097780 --> @d99kris commented on GitHub (Feb 10, 2020): Hi again! I've done some additional tests on the only Exchange server I have access to `smtp-mail.outlook.com` and even using other email clients (Thunderbird) it does not accept sending emails using SSL/TLS (port 465). It only accepts STARTTLS (port 587). Could you please help double-check that you are able to send using SSL/TLS (port 465) with other email clients with your Exchange server? The reason for asking is that nmail is working fine for me to send emails using SSL/TLS (port 465) for other email service providers that does support it. Thanks!
Author
Owner

@Kabouik commented on GitHub (Feb 11, 2020):

I'm sorry I have been (and still am) very busy lately and had no time at all to tinker with all this, but I carefully sorted all the notification emails I received and got pretty excited by the recent development and updates. New features, major fixes, I am looking forward to trying all this and make nmail my computer client too (it is my phone client at the moment, due mainly to #28).

Please bear with me, I'm sorry for leaving you hanging there, but I'll get back to it later (perhaps second half of next week or sometime this week-end).

<!-- gh-comment-id:584557137 --> @Kabouik commented on GitHub (Feb 11, 2020): I'm sorry I have been (and still am) very busy lately and had no time at all to tinker with all this, but I carefully sorted all the notification emails I received and got pretty excited by the recent development and updates. New features, major fixes, I am looking forward to trying all this and make nmail my computer client too (it is my phone client at the moment, due mainly to #28). Please bear with me, I'm sorry for leaving you hanging there, but I'll get back to it later (perhaps second half of next week or sometime this week-end).
Author
Owner

@d99kris commented on GitHub (Feb 11, 2020):

No worries, I fully understand. And definitely no rush :)

<!-- gh-comment-id:584569085 --> @d99kris commented on GitHub (Feb 11, 2020): No worries, I fully understand. And definitely no rush :)
Author
Owner

@Kabouik commented on GitHub (Mar 24, 2020):

I can confirm I could send an email with port 465 from the Exchange account using Mailspring. It took a long time compared to sending emails with 587, so maybe there were some errors/time-outs (I'm not sure how to access logs with Mailspring), but it was successfully sent eventually.

[Edit] Forget that. Port was set to 465 in my test but the protocol was still STARTTLS. I guess that's why sending took longer: it was likely trying with 465 first and then reverted to the default STARTTLS port. I can't connect to the SMTP server when setting port 465 and SSL/TLS protocol.

As I said some weeks ago, I did try both 465 and 587 in nmail but 587 did not work while 465 was working with Disroot from nmail installed on my phone, so I changed my configuration files to 465 for all accounts. However, the test was perhaps biased, because I might have been using the Solus computer at the time, and later realized that this machine could not send any email because of the libetpan issue. Therefore, I tried again to set the Exchange account to port 587, but still no dice. I'm sending you the logs in a minute.

<!-- gh-comment-id:603150434 --> @Kabouik commented on GitHub (Mar 24, 2020): ~I can confirm I could send an email with port 465 from the Exchange account using Mailspring. It took a long time compared to sending emails with 587, so maybe there were some errors/time-outs (I'm not sure how to access logs with Mailspring), but it was successfully sent eventually.~ [Edit] Forget that. Port was set to 465 in my test but the protocol was still STARTTLS. I guess that's why sending took longer: it was likely trying with 465 first and then reverted to the default STARTTLS port. I can't connect to the SMTP server when setting port 465 **and** SSL/TLS protocol. As I said some weeks ago, I did try both 465 and 587 in nmail but 587 did not work while 465 was working with Disroot from nmail installed on my phone, so I changed my configuration files to 465 for all accounts. However, the test was perhaps biased, because I might have been using the Solus computer at the time, and later realized that this machine could not send any email because of the libetpan issue. Therefore, I tried again to set the Exchange account to port 587, but still no dice. I'm sending you the logs in a minute.
Author
Owner

@d99kris commented on GitHub (Mar 26, 2020):

Thanks for sharing the log! I'll need to study it a little before concluding next step.

<!-- gh-comment-id:604393584 --> @d99kris commented on GitHub (Mar 26, 2020): Thanks for sharing the log! I'll need to study it a little before concluding next step.
Author
Owner

@d99kris commented on GitHub (Mar 29, 2020):

So just to try narrow down on the scope of the issue - the problem you have is sending email using an Exchange account only under Solus Linux, is that correct?

The good news is I tested Solus Linux with a Hotmail/Outlook-account and I'm also unable to send emails, so I can reproduce the issue.

The bad news is that it seems it's not a bug in nmail, but rather in the underlying libraries it uses to send email.

If I build libetpan from source and try send using its built-in test program, it works fine under Ubuntu but fails in Solus Linux. For my own reference I send using:

printf "Subject: Test 1\nHello\n" | ./tests/smtpsend -f "d99kris@hotmail.com" -u "d99kris@hotmail.com" -v "***" -s "smtp-mail.outlook.com" -p 587 -S "d99kris@hotmail.com"

The error seem to originate from a libsasl2 call, so it's probably not a libetpan bug. Possibly it's (again) some libetpan build config issue, but I've tried some different libetpan build options without finding a working config (yet).

Will see how to troubleshoot/debug this further.

<!-- gh-comment-id:605635946 --> @d99kris commented on GitHub (Mar 29, 2020): So just to try narrow down on the scope of the issue - the problem you have is sending email using an Exchange account only under **Solus Linux**, is that correct? The good news is I tested Solus Linux with a Hotmail/Outlook-account and I'm also unable to send emails, so I can reproduce the issue. The bad news is that it seems it's not a bug in nmail, but rather in the underlying libraries it uses to send email. If I build libetpan from source and try send using its built-in test program, it works fine under Ubuntu but fails in Solus Linux. For my own reference I send using: ``` printf "Subject: Test 1\nHello\n" | ./tests/smtpsend -f "d99kris@hotmail.com" -u "d99kris@hotmail.com" -v "***" -s "smtp-mail.outlook.com" -p 587 -S "d99kris@hotmail.com" ``` The error seem to originate from a libsasl2 call, so it's probably not a libetpan bug. Possibly it's (again) some libetpan build config issue, but I've tried some different libetpan build options without finding a working config (yet). Will see how to troubleshoot/debug this further.
Author
Owner

@Kabouik commented on GitHub (Mar 30, 2020):

I can confirm I'm not having the issue from Exchange and my arm64 Debian container on the phone.

<!-- gh-comment-id:606022974 --> @Kabouik commented on GitHub (Mar 30, 2020): I can confirm I'm not having the issue from Exchange and my arm64 Debian container on the phone.
Author
Owner

@d99kris commented on GitHub (May 21, 2020):

Finally got a chance to take a look at this. It appears that Cyrus SASL packaged
for Solus Linux is not built with LOGIN authentication support, which is
what Outlook / Exchange servers require.

Some Linux distros package SASL plugins separately (for example named libsasl2-modules) but I didn't see any such package for Solus Linux.

We can work around this by building / installing Cyrus SASL from source.

First make sure that Cyrus SASL and libetpan are not installed:

sudo eopkg remove cyrus-sasl-devel libetpan-devel

Install build pre-requisites (edit: updated as of Jan 2021):

sudo eopkg install git
sudo eopkg install -c system.devel
sudo eopkg install xapian-core-devel
sudo eopkg install sqlite3-devel
sudo eopkg install openssl-11-devel

Get latest Cyrus SASL release:

cd ; wget https://github.com/cyrusimap/cyrus-sasl/archive/cyrus-sasl-2.1.27.tar.gz
tar xvf cyrus-sasl-2.1.27.tar.gz
cd cyrus-sasl-cyrus-sasl-2.1.27

Configure

./autogen.sh --enable-login

And make sure configure step outputs:

checking LOGIN... enabled

Build and install

make -s && sudo make install

Add symbolic link for libetpan to find library

sudo ln -s /usr/lib64/libsasl2.so.3 /usr/lib64/libsasl2.so

Get latest libetpan release:

cd ; wget https://github.com/dinhviethoa/libetpan/archive/1.9.4.tar.gz 
tar xvf 1.9.4.tar.gz 
cd libetpan-1.9.4

Configure

./autogen.sh

Build and install

make -s && sudo make install

Get latest nmail:

cd ; git clone https://github.com/d99kris/nmail
cd nmail

Configure, build and install

mkdir -p build && cd build && cmake .. && make -s && sudo make install

Please let me know if it works, and feel free to re-open if the problem is not solved. FYI - I have not reported any request with the Solus project regarding LOGIN support in Cyrus SASL. Please feel free to do so.

<!-- gh-comment-id:632045459 --> @d99kris commented on GitHub (May 21, 2020): Finally got a chance to take a look at this. It appears that Cyrus SASL packaged for Solus Linux is not built with LOGIN authentication support, which is what Outlook / Exchange servers require. Some Linux distros package SASL plugins separately (for example named libsasl2-modules) but I didn't see any such package for Solus Linux. We can work around this by building / installing Cyrus SASL from source. First make sure that Cyrus SASL and libetpan are not installed: sudo eopkg remove cyrus-sasl-devel libetpan-devel Install build pre-requisites (edit: updated as of Jan 2021): sudo eopkg install git sudo eopkg install -c system.devel sudo eopkg install xapian-core-devel sudo eopkg install sqlite3-devel sudo eopkg install openssl-11-devel Get latest Cyrus SASL release: cd ; wget https://github.com/cyrusimap/cyrus-sasl/archive/cyrus-sasl-2.1.27.tar.gz tar xvf cyrus-sasl-2.1.27.tar.gz cd cyrus-sasl-cyrus-sasl-2.1.27 Configure ./autogen.sh --enable-login And make sure configure step outputs: checking LOGIN... enabled Build and install make -s && sudo make install Add symbolic link for libetpan to find library sudo ln -s /usr/lib64/libsasl2.so.3 /usr/lib64/libsasl2.so Get latest libetpan release: cd ; wget https://github.com/dinhviethoa/libetpan/archive/1.9.4.tar.gz tar xvf 1.9.4.tar.gz cd libetpan-1.9.4 Configure ./autogen.sh Build and install make -s && sudo make install Get latest nmail: cd ; git clone https://github.com/d99kris/nmail cd nmail Configure, build and install mkdir -p build && cd build && cmake .. && make -s && sudo make install Please let me know if it works, and feel free to re-open if the problem is not solved. FYI - I have not reported any request with the Solus project regarding LOGIN support in Cyrus SASL. Please feel free to do so.
Author
Owner

@Kabouik commented on GitHub (May 21, 2020):

Some Linux distros package SASL plugins separately (for example named libsasl2-modules) but I didn't see any such package for Solus Linux.

Is there a specific file that could show whether LOGIN authentication is supported in the system packages? Solus' eopkg has a convenient sf option to search files, maybe they included the required modules in another package. Is there a chance for instance that cyrus-sasl-devel would be what we need? If not, I'll create a new task right away on the Solus dev board, and will follow the manual build procedure you documented (thanks a lot for detailing it so much!).

<!-- gh-comment-id:632133388 --> @Kabouik commented on GitHub (May 21, 2020): > Some Linux distros package SASL plugins separately (for example named libsasl2-modules) but I didn't see any such package for Solus Linux. Is there a specific file that could show whether LOGIN authentication is supported in the system packages? Solus' `eopkg` has a convenient `sf` option to search files, maybe they included the required modules in another package. Is there a chance for instance that `cyrus-sasl-devel` would be what we need? If not, I'll create a new task right away on the Solus dev board, and will follow the manual build procedure you documented (thanks a lot for detailing it so much!).
Author
Owner

@d99kris commented on GitHub (May 23, 2020):

I am not sure if Cyrus SASL uses some standard for this, but In my Ubuntu 20.04 LTS installation LOGIN authentication is provided by this file:

/usr/lib/x86_64-linux-gnu/sasl2/liblogin.so

No, I don't think cyrus-sasl-devel is sufficient. I installed that package while I was doing initial troubleshooting on Solus and tried running the libetpan test program, and it failed to find the SASL2 LOGIN mechanism.

<!-- gh-comment-id:633045574 --> @d99kris commented on GitHub (May 23, 2020): I am not sure if Cyrus SASL uses some standard for this, but In my Ubuntu 20.04 LTS installation LOGIN authentication is provided by this file: /usr/lib/x86_64-linux-gnu/sasl2/liblogin.so No, I don't think `cyrus-sasl-devel` is sufficient. I installed that package while I was doing initial troubleshooting on Solus and tried running the libetpan test program, and it failed to find the SASL2 LOGIN mechanism.
Author
Owner

@Kabouik commented on GitHub (Jun 18, 2020):

I carefully followed the guide you posted (I did it already when you posted it, but here I started from scratch to make sure there was no conflict), checked that LOGIN was enabled, but something still seems to be off: when sending the email I composed with the Exchange account, this time nmail didn't show the failure warning, but the message does not appear in the Sent, Outbox or Drafts folders, and the recipient (myself for testing) didn't receive the message.

I understand this may not be a nmail issue though (Solus devs moved the cyrus-sasl task I opened on their todo list, so there's hope), but I wanted to keep you posted. Also, I hope the Solus update will actually solve this issue, but today's test got me concerned.

On the bright side, it seems the nmail session configured to the Exchange account does not crash as often as it used to (#13), although it still happens. Could that be related to cyrus-sasl? In fact crashes are still frequent on the Exchange account (and rare on others).

<!-- gh-comment-id:646057703 --> @Kabouik commented on GitHub (Jun 18, 2020): I carefully followed the guide you posted (I did it already when you posted it, but here I started from scratch to make sure there was no conflict), checked that LOGIN was enabled, but something still seems to be off: when sending the email I composed with the Exchange account, this time `nmail` didn't show the failure warning, but the message does not appear in the Sent, Outbox or Drafts folders, and the recipient (myself for testing) didn't receive the message. I understand this may not be a `nmail` issue though (Solus devs moved the `cyrus-sasl` task I opened on their todo list, so there's hope), but I wanted to keep you posted. Also, I hope the Solus update will actually solve this issue, but today's test got me concerned. ~~On the bright side, it seems the `nmail` session configured to the Exchange account does not crash as often as it used to (#13), although it still happens. Could that be related to `cyrus-sasl`?~~ In fact crashes are still frequent on the Exchange account (and rare on others).
Author
Owner

@Kabouik commented on GitHub (Jun 18, 2020):

Hum. The exact same test (same sender, same recipient, different object) 5 minutes later made the first email finally go through. The second is still missing.

When sending the second, I could see the status bar briefly showing "Connected" before going back to "Idle". Manually refreshing with "L" did not suffice to actually send the first email, but trying to send a second one worked. Refreshing still does not suffice to send the second email. However now, after navigating through nmail views, I'm "Connected" again but still no second email showing in the recipient account.

<!-- gh-comment-id:646063245 --> @Kabouik commented on GitHub (Jun 18, 2020): Hum. The exact same test (same sender, same recipient, different object) 5 minutes later made the first email finally go through. The second is still missing. When sending the second, I could see the status bar briefly showing "Connected" before going back to "Idle". Manually refreshing with "L" did not suffice to actually send the first email, but trying to send a second one worked. Refreshing still does not suffice to send the second email. However now, after navigating through `nmail` views, I'm "Connected" again but still no second email showing in the recipient account.
Author
Owner

@Kabouik commented on GitHub (Jun 18, 2020):

I kept repeating the same test after restarting nmail and now it seems to work better, with emails actually being received a few seconds after sending them in nmail, without needing to send another one. Perhaps there was some performance issues with my Exchange server when I tried. The second test email arrived much later than the subsequent tests, despite being sent to and from the same accounts, so I'm not sure what was wrong.

Also, messages started to appear in the Sent folder after I set client_store_sent=1 in main.conf. I thought this was not necessary for Exchange, but I was wrong.

<!-- gh-comment-id:646074783 --> @Kabouik commented on GitHub (Jun 18, 2020): I kept repeating the same test after restarting `nmail` and now it seems to work better, with emails actually being received a few seconds after sending them in `nmail`, without needing to send another one. Perhaps there was some performance issues with my Exchange server when I tried. The second test email arrived much later than the subsequent tests, despite being sent to and from the same accounts, so I'm not sure what was wrong. Also, messages started to appear in the Sent folder after I set `client_store_sent=1` in `main.conf`. I thought this was not necessary for Exchange, but I was wrong.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nmail#20
No description provided.